Bug fixes from Susi Lehtola, provided by email on Dec. 3, 2013.