cherry-pick 2596f8ef7a0fa12f5b9b056b3af0fea872c1c284