fixed bug when using auto-completion