Backport of #3315
Merge pull request #1407 from drewhk/wip-3315-backport-drewhk

Backport of #3315