Update math.lib

fixed some bugs