Merging autocomplete frontend

Fixing a bug in autocomplete backend as well.