finally fixed the bugs in the unifier