fix bugs and typeahead