fix bug when no headers, number of sections calculation was wrong