Fix total calculation