More bug fixes to the encryption