fixed, added tests