Bug fixes

Hi Simon.

Thanks for the awesome library. I noticed a few minor errors which I have fixed in this pull request.

Cheers,
Adam