Fix encryption functions