Bugfixes for rendering text in a window