fixed some math lib errors