Cherry picked changes from 10.x branch