Corrects bugs when deleting a public key