Fix bugs in crypt libs