make lastmaxdiff use math.abs