Merge #304 from @drkibitz, and fix conflicts