Fix search function