Backports #3397 to 3.1.0-stable branch
Merge pull request #3622 from jonhyman/feature/backport-3397

Backports #3397 to 3.1.0-stable branch