mapping template fixes: multi instance and sorting

Change-Id: Ib8eff4592deb535fb8cea793c3b121bf0eebde34