fixed some errors in unification