fixed bug in HMAC calculation when payload has been sent but not used for the HMAC calculation