fixed a bug
trying to deal with formula, turns out it is non-trivial