Fix search never finishing bug