Fixed some EncryptionManager bugs