Fixed bug in copy_file