Bug fix for client disconnection