Fix wrong key generation