fixed a bug with totals