merge PR 165, mostly