fix typos and add try-catch around js