Improved handling of HMAC errors