Reapplying some fixes that I think DM may have saved over, whoops.