Various fixes

Fixes #11 and #7