fix header part of writefile