Cherry-picked changes from master