Improved handing of conneciton errors.