fix encrypt/decrypt (mostly)