add write_with_header