Fix search bugs