Thanks James Cleveland for the report and Aymeric for suggesting the solution. Backport of da59902250 from master