Cherry-pick from heroku/master