added tests, found 2 bugs :O