fixed some bugs with autocomplete
merged