fixed small connection management bug