Fixed a bug for typeahead