Backported Mikhail's 3cec23f to 3.3.x.
Merge pull request #463 from jimis/3.3.x

Backported Mikhail's 3cec23f to 3.3.x.