Fixed errors with subtotal/total calculations