Remove uses of deprecated math.mod