subtle bug involving resetting match count