fixed bug in disconnection