fix endless loop in matched record set generation