Repaired argmax and argmin