Fixes for sort-order management