Modified the calculation for total stresses.