Backport PR #2622