fixed a few bugs
Merge pull request #3 from samjarman/pr/2

Pr/2