Fixing copy_to_local_file method