Ported to NAN 1.2.0