Fix segfault as discussed in https://github.com/joyent/node/issues/8208