refactoring of js basic funcs, and annotation bug fix