Fixes ordering issue when merging sparse sets

The order of the sparse indexes is important, not the absolute order.
Otherwise, a smaller value (by absolute terms) can be inserted before a
smaller value (as far as sparse set index).