Fix invalid zero-length ranges in IndexSet/MCOIndexSet

This should fix MCOIndexSet/IndexSet so that ranges with zero length aren't used to store single indexes. The C++ API hasn't changed so should be transparent to the rest of the library.