Small change in genKey()