Adapted connection code to correctly generate default expressions for linear and calibrate modes.