Fixed clearMatches method