improvements to Cart->apply_cost