update connection logic