Backport of 1.9.6.