fixes for keypair magic