Tesla Motors and Elon Musk have agreed to pay $20 million each to the US Securities and Exchange Commission (SEC) under a settlement with the regulator, but the bigger news is that Musk – the face of the electric car maker and brains behind it – will step down as chairman. He will remain as the CEO, though.

The SEC had charged Musk with misleading investors with tweets on August 7 that said he was considering taking Tesla private at $420 a share (at a 20% premium) and had “funding secured”. In actual fact, the announcement had no basis, and the ensuring market chaos hurt investors, the regulator claimed. The public listed company’s share prices went up after Musk’s tweet.

The securities fraud agreement will come as a relief to investors, who had worried that a long legal battle would only further hurt the loss-making EV company, Reuters reports. It may also be a blessing in disguise. Corporate governance experts and investors say this episode could strengthen Tesla, which has been affected by Musk’s recent erratic behaviour.

The latter includes accusations that a British rescue diver in the Thai cave boys case is a “pedo” and a “child rapist”, and smoking marijuana live on a web show. The unpredictable visionary also recently said that he had been working 120-hour weeks.

Tesla must now appoint an independent chairman, two independent directors, and a board committee to set controls over Musk’s communications under the proposed agreement. That should in theory place more oversight on Musk without removing him from the company.

“The prompt resolution of this matter on the agreed terms is in the best interests of our markets and our investors, including the shareholders of Tesla,” SEC chairman Jay Clayton said. The regulator pulled back from its demand that Musk be barred from running Tesla, which would be disastrous on the company.

The charges on Thursday knocked about $7 billion off Tesla’s stock price to $45.2 billion on Friday. That day, Musk sent an email to Tesla employees, urging them to “ignore all distractions,” because “one more hardcore weekend and we will all be victorious.”

On Sunday, he sent out another email to staff, which read: “We are very close to achieving profitability and proving the naysayers wrong, but to be certain, we must execute really well tomorrow (Sunday). If we go all out tomorrow, we will achieve an epic victory beyond all expectations. Go Tesla!”

The victory in question is most probably the production goal for the Tesla Model 3. According to Electrek, after months of delays, Tesla achieved new record production with two days to spare before the end of the quarter. The carmaker was targeting 50,000 to 55,000 units of the Model 3 for Q3 2018. Finally out of “production hell” it seems.