Fix node wrapper to handle disconnects better