Fix: handle connection error