fix edge case of an index array with an axis of length zero