Cherry-picks 3.0.1 fix on to 4.x.x
WARNING: BREAKING CHANGES were introduced separately in both 4.0.0 and 4.0.1.
This adds the fixes introduced in 3.0.1 to 4.x.x.
WARNING: BREAKING CHANGES were introduced separately in both 4.0.0 and 4.0.1.
This adds the fixes introduced in 3.0.1 to 4.x.x.