Merged from mwolson@gnu.org--2005 (patch 333, 337, 345-346, 349)