Fix the issue with counting matches.