fix bugs in string matcher