Fix counting of matches