fixing min/max to return indices as well (when given an arbitrary dimension