fixed the math stuff