Fixed unification + lwt bugs, added tests.