Fix public key calculation