Fix a bug in output_material_id.