Fixed some major issues in autocompletion lookup

Sorry ... the lookup was quite broken. Also fixed lookups for paths that has '+' in them.