Fix bug which would free up a public key