[m] Fixed bug with grouping of typemasks