Fix header reading
Add header tests - reading, writing, group writing