fix bugs in repeatMatcher