fixed a bug that causes truncation when the text of a window was read from os