fixing a couple of corner cases that were causing crashes
Merge pull request #28 from mistercrunch/fixes

fixing a couple of corner cases that were causing crashes