Fixed a bug write in encryption.