ef4ff9b6fb
PR #2165 was LGTM'ed, but the CLA check failed even after contributor signed it, so I'm reimplementing those changes here.