updated the new unification algorithm
added occurs check