Cherry pick upstream changes from main repo