bug fixes and tests
Merge pull request #8 from yields/master

bug fixes and tests