added some verifications to the search