fixing totalAp calculation