Bug fixes

Fixes #9 and #10