[JS] Fix bugs in initial push refactor