fixed some mistakes in the math