Fix edge-case bug in possibleNewPubkey function