bug fix for search function