error handling for copy