Unification fix
If f x = g y fails to unify due to f and g failing to unify, record the
whole application as failed, otherwise we might accidentally unify x
and y.
Fixes #409