Improved handing of conneciton errors.
Merge branch 'test' into dev