fix error in copyng code