Fix some Node.js cross-platform compatibility issues

Thanks to http://shapeshed.com/writing-cross-platform-node/

Surprising that file path format is pretty much the only issue.