fixed a bug in math.diff()