fixed issue with directory permissions on copy

fixes #6552