Some fixes for TestJavascript

See my commits for details.