Fixing bug in the formula