Bugfixes on the javascript api