added tests, fixed 1 bug found