fix bugs in JS compiler and test framework