fix bug where cart->clear also deletes cart.