BugFix: use the maximum as the comments says, NOT the minimum