fix the search functionality