small cleanups in pubkey handling