Fixes #131, fixes #142