small bug fixes
Merge pull request #3 from michaelnatkin/master

small bug fixes by @michaelnatkin. Thanks for the patch, much appreciated. Apologies for the delay with checking this out.