bug fix writeChar