fixing bugs in the type unification mechanism