Added cleaning of inventories when deleted