Thanks to Simon Charette for locating where issue lay. Backport of de1c8320cedee5d4f91b153a7fe82eb63876470f from main