fixed the search function