Recreating the connection when reconnecting. This should fix the crash when reconnection.