Fix range partitioning so that the split is done in the right order