fixed a bug, added tests