Fix rethrowing too early if not in Node