fix typeahead code