fix highlighting bugs from right to left.