fixed bug in crypto key gen