Fixes headers being set correcly - one shall think before refactoring working code.