cherry-pick changes from master