fix hmac serialization errors (can't always serialize it as bytes)