fix header parsing when multiple headers are provided