Backport of 9c19aff7c7561e3a82978a272ecdaad40dda5c00 from main.
Follow up to e29637681be07606674cdccb47d1e53acb930f5b.