Rewrite ensure_materials_available