Fix search code