All denormalized elements are converted to strings to avoid "int < str" exceptions. However this causes list indices to be sorted lexicographically rather than numerically which is counterintuitive. A simple workaround is probably just to add a large integer offset to the index in the sort key function.