fixed header parsing bugs