Compatibility fixes for node.js