base64 is borken, use hex
also, fix errno