fix bugs with autocomplete