Fixed errors in the math