Fix header parsing and add test utility.