Fix M2 header parsing