JARVIS-482 changed header writing flow