fixed subtotal calculation