Fix upgrade mode IO (not sure it is 100% stable yet though), tested with websockets.