Fixed handling of client disconnects.