fix bug with sum