fix bug with new textbuffer data structure and only strip newline chars in the string