fix encrypt and decrypt issue