Security improvements
Merge pull request #715 from bartekn/security-improvements

Security improvements