More robust handling of empty searches