The sorting of index vectors assumed that all vectors have at least one element. Now this is checked for more explicitely.