Fixed bug in client disconnection handling