(Reuters) - Tesla Inc TSLA.O on Wednesday pushed back its profit timeline once again after missing financial targets in the second quarter, while announcing that the pioneer of the company's electric batteries, J.B. Straubel, was stepping down from his role as chief technology officer.

A quarterly loss was deeper than expected, and despite record deliveries in the quarter, revenue came in lighter than analysts’ expectations. Moreover, margins - a focus of investors - narrowed in the quarter, adding to Tesla’s challenges in delivering profit going forward.

Shares fell 11.5% after hours and extended losses after the announcement about Straubel, a founding engineer who will become a senior adviser.

Under pressure to meet his repeated promises to make Tesla sustainably profitable, Chief Executive Elon Musk is trying to contain costs while still spending on major initiatives from a Shanghai factory and assembly-line to upcoming models such as the Model Y SUV and a Semi commercial truck.

Tesla initially promised to be profitable in the third quarter of 2018 and has now pushed back that target multiple times. Now profit is expected in the fourth quarter of 2019, with the current quarter to be break-even, Musk said.

In a statement on Wednesday, Tesla said it was focusing less on profit and more on volume growth, capacity expansion and cash generation. Musk said the company had grown to the point of “being self-funding,” indicating he might not need another cash infusion following a record-setting capital raising earlier this year.

Tesla said on Wednesday it had trimmed its capital expenditure target for 2019 to $1.5 billion to $2.0 billion, from $2.0 billion to $2.5 billion. It ended the quarter with $5 billion in cash and cash equivalents.

Investing.com analyst Clement Thibault told Reuters that Tesla’s results “will inevitably lead to more questions about its ability to stabilize and turn a profit.”

Tasked with Tesla’s groundbreaking battery technology since Tesla’s early beginnings, Straubel directed the development of the audacious plan to make a sportscar powered by bundled laptop batteries. The quiet, retiring Straubel has been seen as a good partner for showy Musk. Straubel had been the last senior executive of long-standing at the very top rank of the company to remain at Tesla.

FILE PHOTO: A Tesla logo on a Model S is photographed inside of a Tesla dealership in New York, U.S., April 29, 2016. REUTERS/Lucas Jackson/File Photo

Even while growing, Tesla has laid off workers and pledged to close some stores to lower costs. Facing increased competition from a slew of European rivals with electric offerings, it has also tinkered with its pricing.

Most recently, it eliminated the least expensive versions of its Model S sedan and Model X SUV, while cutting the starting price of its Model 3 to $38,990.

Tesla’s strong second-quarter deliveries assuaged doubts about demand for the Model 3, but concerns linger, especially since a federal tax credit was cut by half on July 1 and expires at the end of the year.

Many analysts note that Tesla will be challenged not only to meet its deliveries target of 360,000 to 400,000 vehicles this year, but to keep profit margins from further eroding.

Automotive gross margins dropped in the quarter from 20% to 19%.

Musk gave bold predictions for the long-term demand for the Model 3 and upcoming Model Y combined, saying that it could reach 2 million vehicles per year.

The company repeated a target of producing 10,000 vehicles per week globally by the end of 2019.

Chief Financial Officer Zachary Kirkhorn said orders in the current quarter were so far higher than those seen in the second quarter.

A 58.7% revenue rise to $6.35 billion in the quarter fell short of the $6.41 billion estimated by analysts, according to IBES data from Refinitiv, even as a non-GAAP loss of $1.12 per share was deeper than the loss of 36 cents they expected.

Shares of Tesla are down 22% since the beginning of the year, but they have been rebounding since early June, after hitting their lowest close since early 2016 at $178.97.