fixed stack overflow on matching rules