fixed bug when formattin headers