Fixes #158, #159, #160