change `comp` to `key` in min/max