Fixed, added tests