correct handling of unification and aliasing between variables