improve pubkey funtions thx @LAndreas