Bug fixed for search function