corrected header handling