fix bug in formulas