Manual Backport of #710