bug fix write