Fix bug in "write text" method.