bug fix in filewriter