bugfix: skip writing header if appending