Fixing issue when recalculating totals with quantities

#2768