Check for undefined to make compatible with node 0.10