Merged from jeho@jeho.org--2005 (patch 54-55), mwolson@gnu.org--2006 (patch 16)