fixes to private key functionality