Handle connection issues without crashing