fix for bug causing duplicates of matches