Fixed template mapping: type name wasn't properly inferred

Closes #675