bug fixes for autocomplete