fix bug that cause errors in word highlightening