error check in public key