handle headers more defensively