cherry-picked commit 94e7e954f95ba6926c592312d40fe58e8d5e85d2