fix performance issues
Merge pull request #2885 from FlorinPeter/files_encryption

fix performance issues