Fixing key generation