Fix autocomplete ordering, fixes #368