add tests, fix some errors
Merge pull request #2 from Roenke/tests

add tests, fix some errors