fixes for copy_from and copy_to