Fixed max/min functions.