Made min/max more error friendly.