Fix bug with invalid search