Cherry picked fc533afe4576f13aeac4d5b8e9e31c8bc89a1c72