fixing sort in collection sort_index (was returning sort index + 1)