added tests, fixes #1