Tesla CEO Elon Musk had prepped Wall Street for a first quarter loss but analysts were still stunned by its size: $702.1 million, among the company’s worst quarters in the past two years.

The net loss was more than double what analysts had predicted as Tesla’s sales slumped 31% for the quarter. The loss of $4.10 per share left Musk spending much of a conference call explaining how it happened. But he also extolled his forecast that demand and profit margins will increase as Tesla rolls out updated products and pricing for its three models, and sells more battery storage units.

Demand for Tesla’s Models S, X and 3 is returning to normal in the second quarter after the company delivered only 63,000 vehicles from January through March, Musk said.

“My impression right now is that demand is quite solid, quite strong,” he said Wednesday.

He predicted another loss in the second quarter but said Tesla would be back in the black in the third quarter. The first quarter loss came after two consecutive profitable quarters, the first time that’s happened in Tesla’s 15-year history.

The company said that due to “unforeseen challenges” it was only able to deliver half of the vehicles ordered in the quarter by March 31 as it ramped up deliveries in Europe and China. That pushed a large number of deliveries, and revenue, into the current quarter, it said.

Tesla’s cash balance at the end of the quarter shrunk by $1.5 billion since December, to $2.2 billion. The company attributed the decline to a $920 million bond payment, and Musk said it might be time for Tesla to raise capital again.

Excluding one-time items and stock-based compensation, the company lost $2.90 per share, worse than Wall Street estimates. Analysts polled by FactSet expected a loss of $1.15 per share. Revenue rose almost 40% over a year ago to $3.5 billion. But it still fell short of analyst estimates of $5.42 billion.

Despite the less-than-stellar numbers, Tesla’s stock was little changed in extended trading Wednesday following the earnings report. Shares were down more than 2% in early trading on Thursday, and down more than 6% for the week.

The company said one-time items cost it $188 million during the quarter, including a loss for predicted increases in return rates for cars that had been sold under Tesla’s used car price and buy back guarantee programs. Tesla has guaranteed the value of the cars after certain time periods and will buy them back for a guaranteed price.

The company still expects to produce 360,000 to 400,000 vehicles this year, and if a new Chinese factory hits volume production at the end of the year, it could make 500,000.

Tesla likely is nearing its “cash floor,” the amount it needs in the checking account to pay all the bills, said Gartner analyst Michael Ramsey.

“It’s anxiety provoking,” Ramsey said. If Tesla continues burning cash at the first quarter rate, it would run out of money in less than six months.

But Ramsey said that’s not likely. If Tesla can produce and sell all the vehicles that it predicts in the current quarter, it will generate a lot of cash, easing its problem. Tesla said it believes deliveries will hit 90,000 to 100,000 vehicles from April through June.

Tesla, Ramsey said, has many supporters and shouldn’t have trouble borrowing money or issuing more stock to generate cash. The fact that Musk said it may be time to raise capital means “you can pretty much count on it,” Ramsey said.

Musk also told analysts that the company has become more efficient as it tries to save cash.

“I think it’s healthy to be on a Spartan diet for a while,” he said.

Chief Financial Officer Zachary Kirkhorn, meanwhile, hinted on the conference call that Tesla will build its new semi starting next year at its factory near Reno, Nevada. That’s where the battery and electric drive units will be made, he said.

And Musk said the company will decide in the next few weeks whether it will build the Model Y small SUV in Nevada or at its Fremont, California, factory. Deliveries are scheduled to start in the fall of 2020.

Musk also said Wednesday that average prices for the Model 3 mass-market car are running around $50,000, with very few taking the $35,000 version.

Another problem for Tesla is fading sales of its higher-priced models S and X as the vehicles age. But Tuesday night, the company announced updates to both, including a new drive system that increases the range by 10% per electric charge. Long-range versions of the S will be able to go 370 miles per charge, for example. The vehicles also will get new suspensions, faster acceleration and more comfortable rides, Tesla said.

Profit margins on the S and X, which can run well over $100,000, should rise because the improvements actually save the company money, Musk said.

Tesla has lost more than $6 billion since setting out to revolutionize the auto industry 15 years ago, but Musk foresees a profitable future fueled in part by a ride-hailing service made up of electric cars driven by robots.

Musk believes Tesla’s technology is capable of letting the vehicles drive themselves. That terrifies some critics who worry Musk’s plan to transport passengers in self-driving Teslas without a human to take control in emergencies will maim and kill people.

© The Associated Press. All rights reserved.