fix bugs with formulas