Fix conditional in doConnect