cherry-picking 3a4d1cd86657505137b2e5057c6015b00127590a