update_material_cost function makes one unnecessary call to get_item. Fixed by @kvvar...