Added function to delete CMSMaterial properly