Fix to a searching bug