small bug fixes with total calculations