fixing sum formulae