Merged from mwolson@gnu.org--2006 (patch 171-193)