Revert r30852: the wrong version of this patch got committed to SVN.