fix the search function definition