Revert "Improved copying of files"

This reverts commit 9bfffe75f0beb1405c64928f78171ad1164dc05f.
Revert "Revert "Improved copying of files""

This reverts commit 5ac20ac37a6f06cf568d32f22eda6bae03c6bb78.
fixed copying
merge commit