Fixed some compat

Use math.max here