fixed the order of serialize, encrypt, decrypt, unserialize