Original import from SVN revision 1162.