fix math functions