rework for node 0.8+