fix bugs with typeahead #1148