added test cases, fixes #1