Restoring connection after being lost