manually applied some fixes from main before merge.