fix match not found when match includes last character