Backport PR 3772