node.js fixes and mocha tests