write header only once