Fix infinite loop if discarding first search result