Fix bug in "get context" method.
Improve function for getting window text.