FIX: bug fix in merge algorithm, wrong use of typeVarMap. How did this ever work?