Fix bug in applyPattern

Should not replace unbound metas with 'undefined'
Implement anti-unification