Fixed calculation of numeric values