Fix error with totalProfit