Bug fixes by tsw, Calguy, and SjG.