bug fix write results