get default connection when null

Resolves  #2140.