fixed erroneous condition in the autocomplete