minor bugfix when cleaning connections