Fix bug regarding undefined var $script
Add autocomplete feature