Fixed a small bug on the search process