bug is fixed, problem was that the variable substitution case did not check to see if the left hand side variable occured in the rhs term