Effect of defects on the thermal conductivity in a nanowire