fix surrounding text heuristic