Fix save_keypair function, and some other minor stuff