Walmart shocked Wall Street on Wednesday morning when CFO Charles Holley told a group of stock analysts that this year’s sales and profits would be lower than previously forecast, and profits would fall still further next year. In just 20 minutes—between 10:36 am and 10:56 am, to be precise—the company lost $23.4 billion of market value, or over $1 billion a minute. Not a good day in Bentonville.
Yet shareholders should be patient with CEO Doug McMillon, who got the job in February 2014 and is being a genuine leader with his decisions. I don’t blame investors for dumping the stock; profits in 2017 are worth less than profits today. And I make no predictions about how McMillon’s strategy will turn out. No one can know. But consider:
McMillon is trying to fix a deep-seated problem at Walmart (WMT) that goes back long before he was CEO. Investors have not expected growth in the company’s economic profit—earnings after a capital charge, the most telling measure of corporate performance—for six years now. On the contrary, even before Wednesday’s rout and going back to 2009, Wall Street has been pricing Walmart’s stock in expectation of falling economic profit. That’s why Walmart stock has gone nowhere for years, and it’s the big problem McMillon must fix.
Notably, he announced last February that the company would raise minimum pay for store workers to $9 an hour in April, which it did, and to $10 next February. That step is significant because it alone will cost the company an additional $1.2 billion this year and $1.5 billion next year, accounting for 75% of yesterday’s projected earnings miss, Holley said. Why would McMillon do that?
To see part of the answer, let’s ask another question: Everyone knows Walmart is America’s largest retailer, but do you know who’s No. 2? It’s Costco, which is booming and whose stock closed yesterday near a new all-time high. Costco (COST) operates on a much different business model from Walmart’s, but it offers lessons nonetheless. Under its former CEO, the great Jim Sinegal, it started paying workers more than necessary years ago. Store workers now make an average of $20.89 an hour, says the company. Sinegal knew that wasn’t a cost, it’s an investment that pays off in better workers, lower turnover, better service, and happier customers.
McMillon has also changed several members of the top team. He’s pushing hard to make Walmart better at retail basics—neatness, merchandising, efficiency. And he’s investing big—as he must, and as previous chiefs should have done—in building a Walmart-scale e-commerce operation that incorporates 4,000-plus U.S. stores for merchandise delivery, pick-ups, and returns. All those changes cost money before they make money.
Walmart’s problems were a long time in the making, and they’ll take time to fix. At least so far, and despite a really bad stumble, McMillon may still well be the leader Walmart needs.
Sign up for Power Sheet, Fortune’s daily morning newsletter on leaders and leadership.