Fix wrong use of min() function.