Fixes and improvements to cxx2js