better handling of symlinks while copying in copy_file