CHICAGO (Reuters) - Facing lower margins from its rising e-commerce business, package delivery company United Parcel Service Inc UPS.N said on Tuesday that it would pull forward investments in automation and technology and could raise prices to offset the reduced profits from delivering packages to consumers.

United Parcel Service aircraft are loaded and unloaded with air containers full of packages bound for their final destination at the UPS Worldport All Points International Hub during the peak delivery season in Louisville, Kentucky, December 9, 2016. REUTERS/John Sommers II

Atlanta-based UPS posted a quarterly loss Tuesday caused by a pension charge and gave a full-year profit forecast below analysts’ expectations, helping push its shares down nearly 7 percent.

Like rival FedEx Corp FDX.N, UPS has been struggling to figure out how to lower e-commerce-related costs. UPS and FedEx have raised package rates by between 4.9 percent and 5.9 percent annually since 2009.

“At the same time as we’re going to focus on the cost curve ... we’re also going to continue to focus on yield management,” Chief Executive David Abney told Reuters. “If (e-commerce) is going to continue to drive additional costs, then we have to make sure we pass on that cost to our customers.”

Delivering packages to residential addresses costs more than to businesses because businesses received more packages per stop than individual consumers.

UPS said fourth-quarter shipments to residential addresses from business rose 11.5 percent and a record-high 63 percent of deliveries in December were to homes. But while revenue at UPS’ flagship U.S. domestic package business rose 6.3 percent, revenue per package fell 6.1 percent.

Abney said the company would increase its capital expenditures to around $4 billion in 2017 from $3 billion last year, further boosting automation and technology to handle e-commerce packages.

He said UPS would examine how to pass on rising costs to customers.

Stephens Inc analyst Jack Atkins said that investors are beginning to chafe at rising capital investments at UPS and FedEx that have not led to margin growth in recent years.

“What’s got people troubled is they’re making all these investments just to keep margins where they are,” Atkins said. “Investors are beginning to ask when will we see returns on these investments?”

In a client note, Credit Suisse analyst Allison Landry said the additional spending “calls into question whether e-commerce is more capital intensive than previously understood, and it leaves less cash available for share buybacks.”

The package delivery company reported a fourth-quarter net loss of $239 million, or 27 cents per share, compared with a net profit of $1.33 billion, or $1.48 per share, a year earlier.

Excluding the non-cash, after-tax pension charge of $1.90 per share, UPS reported earnings per share of $1.63. Analysts expected $1.69.

The charge is related to the company’s defined benefit pension programs for employees. When UPS finds that its long-term obligations for the pensions are not fully funded, it sets aside extra cash to cover the shortfall.

UPS said it expected full-year 2017 EPS in a range of $5.80 to $6.10, adding that the strong U.S. dollar should lower adjusted EPS by 30 cents.

Analysts have predicted earnings per share of $6.17 in 2017, according to Thomson Reuters I/B/E/S.

Revenue in the quarter rose to $16.93 billion from $16.05 billion a year earlier.