fixing serialization of private key