Fix the bug with highlighting incorrect ranges