Fixed crash during encryption