Squashed 'lib/' changes from 9df3847..cc9b13e

cc9b13e Issue #62 A few bug fixes
f236e65 Incorrect merge is reverted

git-subtree-dir: lib
git-subtree-split: cc9b13e47b29a5f51957a6354511c42115706814
Merge commit 'a92e26c6a13830cbca831023cd10d9669eba7fa4' into ellmaster