fixed the calculation