Cherry picks from master

Cherry-pick some changes from master