fix heap corruption in carbon plugin