fix match counter logic