Tesla rattled investors on Wednesday by reporting profit that fell short of expectations and revealing that its chief financial officer is leaving — the latest senior executive to exit the electric car company.

CEO Elon Musk said on an earnings call Wednesday that CFO Deepak Ahuja is retiring. Ahuja had returned to the company less than two years ago after its previous CFO unexpectedly quit.

Following the announcement by Musk, Tesla shares fell about 5% in after-hours trading. The company was shaken last year by a series of departures by top managers, including a chief accounting officer who left after less than a month.

Musk said that Ahuja’s retirement will not be immediate, and that he will continue to serve as a senior adviser to the company. Zach Kirkhorn, the company’s current vice president of finance, will replace him as CFO.

He’ll inherit a profitable company. Tesla on Wednesday reported net profit of $139 million for the three months ended in December, its second consecutive quarter in the black.

But the latest earnings were down from the $312 million profit Tesla posted for the previous quarter and lower than investors had hoped. The earlier profit marked the first quarter since 2016 that the company hadn’t lost money. Musk pledged at the time it was a sign of more healthy earnings to come.

One of Tesla’s big problems was the months-long struggle to ramp up production of its Model 3 sedan. On Wednesday, the company sought to reassure investors that the manufacturing woes are over.

“Model 3’s production rate progressively improved” last quarter, “with December 2018 being our highest volume month ever,” Tesla executives said in a letter.

The company said it expects to be producing about 7,000 vehicles per week at its factory in Fremont, California, by the end of the year. Tesla said that as it continues to boost Model 3 production rates, it expects the cost per vehicle to decline.

“It is critical that we continue this trend so that we can keep increasing the affordability of Model 3 while retaining a sustainable level of profitability,” the company said.

Earlier this month, Tesla announced layoffs impacting about 7% of its full-time workforce. Musk said the layoffs were necessary to allow Tesla to sell variants of the Model 3 at lower price points.

The cheapest Model 3s are currently selling for about $44,000, but Tesla has long promised to make a $35,000 version available.

A new plant in China could boost the Model 3 production rate even higher.

“Barring unexpected challenges” with the planned factory in Shanghai, the company said, the added assembly lines could bring weekly Model 3 production to 10,000 sometime between October 2019 and June 2020. Musk, who has often set deadlines that are not met, said he expects to hit that rate by the end of 2019.

Tesla said its cash stockpile grew to $3.7 billion in December, up from $3 billion in September. Investors keep a close eye on Tesla’s cash stores because the company has hundreds of millions of dollars in debt payments due in the coming months.

“We increased our cash on hand by more than $700 million, even after paying debt,” last quarter, Musk said Wednesday, adding that Tesla has enough to pay off debt coming due in March.

Looking forward, Musk said he’s “optimistic about being profitable” in the first quarter of 2019 — but “not by a lot.” The company warned its results from the current quarter will reflect a “one-time restructuring cost.”

To post a profit, Tesla will have to “successfully execute on many fronts including handling logistics and delivery challenges in Europe and China,” the company said.

Musk said Tesla is also focused heavily on improving service operations in North America after reports of poor customer service and repair delays. Musk has said Tesla suffered with logistical issues as it rushed to deliver Model 3 vehicles to customers after solving production backlogs.