Backport to node 0.8.x