How to fix public key errors