Corrected bug in handling header