added id transformation for arrays in sorting

This fix allows to use multiple sorting with directions