Better error handling for header frames