Fix autocomplete bugs