Forward port of issue #1234 to 2.2.x.