Bug fixes

`v0.2.3` as installed from npm wasn't working for me. I took a look at the code and fixed up a few things. I think it's all working as expected now.