fix #1395 and speedup context.autocomplete a lot