Made `max` and `min` work with indexes.