Reapplies LightningIron's fix for #6131