Changed the way header size is calculated