add tests, fixes #2