Tesla reported the biggest loss in its history. But it could've been worse

(CNN Money) -- Tesla's finances are so dicey that the largest quarterly loss in the company's history couldn't bring investors down.

The electric car company said it lost more than $717 million in the second quarter. But it ended up with $2.2 billion in cash at the end of June -- way more than most had feared. Tesla only had to burn through $430 million worth of its unrestricted cash reserves.

Tesla spared no expense to reach its long-sought milestone of making 5,000 Model 3s in a week. But with low cash reserves, investors have worried that Tesla would need to borrow more money to keep the company afloat.

The company said it maintained its level of production, producing 5,000 Model 3s in a week multiple times in July. Tesla expects to make 50,000 to 55,000 Model 3 cars this quarter.

Tesla's stock was up 5% in after-hours trading.