typeahead: fix bugs