fixed a math issue