manaul cherry-pick from abettino for 0 length autosuggest bug