Connection errors handling and test fix.