fix bug of accumulating failed connect attempts