Refactor dialects to survive after reconnect