New York CNN Business  — 

Even after delivering a record number of cars in its second quarter, Tesla (TSLA) is still bleeding money. Tesla (TSLA) said Wednesday that it lost $408 million during the three months ending in June, far worse than Wall Street had expected. Shares of Tesla (TSLA) fell more than 10% in after hours trading following the earnings report.

The loss was slightly less painful than the previous quarter, in which Tesla lost $702 million. The company attributed its performance to record vehicle delivery numbers of more than 95,000 cars. That was up nearly 5% from the previous record in the fourth quarter of 2018. It also said some of the quarter’s losses were because of one-time operating expenses and currency fluctuations.

CEO Elon Musk announced on a call with analysts Wednesday afternoon that J.B. Straubel, a founding member of the company, is stepping down from his role as chief technology officer and will become a senior adviser. Current vice president of technology Drew Baglino will take on most of Straubel’s responsibilities.

“It’s been quite an adventurous 16 years,” Straubel said on the call. “This is not some lack of confidence in the team or company or anything like that.”

The company reported improved margins for its best selling car, the Model 3. Though it cut the starting price for the Model 3 in February, the average selling price for the car remained stable in the second quarter at around $50,000 and manufacturing costs declined, Tesla said.

However, overall auto gross margins slid to about 19%, down from above 20% in the first quarter.

After reporting the company’s second consecutive quarterly profit in January, Musk said he was “optimistic” about Tesla being profitable in the first quarter and “all quarters going forward.” That optimism was perhaps premature as the company has continued to work to contain costs as it ramps up production further.

“I think everyone was a bit surprised, we thought this could be a moment where Tesla makes some more positive news,” Jessica Caldwell, executive director of insights for Edmunds, told CNN Business.

Tesla is now projecting a turnaround, reporting that it is aiming for positive net income in the coming quarter. It also confirmed that it remains on track to launch its Model 3 production facility in China by the end of the year — a move expected to give the company better access to the Asian market. Musk, of course, has a history of setting bold goals that have proven difficult to deliver on.

Caldwell said she thinks the projected end-of-year opening date for the China production facility is likely unrealistic, though she expects that location to help the company gain new customers as demand for the Model 3 wanes in the United States.

Tesla also announced it is changing the way it reports guidance for upcoming quarters. The company will no longer announce expectations for each of its business divisions. Compared to the previous quarter’s report, Tesla did not share revenue growth projections for its “energy generation and storage” or “services and other businesses” divisions.