Parse headers more carefully