In June, India’s shadow banking sector was on the verge of collapse. But three months later, things are looking up for the $370 billion industry.

Despite the challenging macro-economic environment, the shares of leading non-banking finance companies in India have shown a stellar performance since July. Shares of Bajaj Finance, Chola Investment and Finance and Mahindra & Mahindra Financial Services, among others, have outperformed Bombay Stock Exchange’s benchmark 30-stock Sensex.

This is against the usual trend as NBFCs, which lend without a banking licence in India, are considered “cyclical firms” whose fortunes are tied to the macroeconomic conditions. Experts believe the recent good performance is because the sector has learned from its past mistakes and is making the right moves now.

“Our discussions with listed and smaller unlisted NBFCs and co-operative societies across states indicate that the liquidity situation for most such lenders is comfortable currently,” observe analysts at Mumbai-based research and investment firm Emkay Global Financial Services. “Recent capital raise by most NBFCs has improved overall capital adequacy and would suffice for any ad hoc provisioning requirement.”

Since the coronavirus outbreak in the country in March, Indian NBFCs have raised Rs 28,600 crore ($3.9 billion) through stake sales and equity markets, according to the global wealth management firm Credit Suisse.

The government and central bank’s moves to help the sector overcome the slump have also worked. “Market financing conditions for NBFCs, which had become challenging, have largely stabilised in the wake of targeted policy measures,” Reserve Bank of India governor Shaktikanta Das said in his August monetary policy speech.

At the same time, the collection or repayment of loans is improving with fewer borrowers opted for a moratorium (halt in payment of dues or interest) in the last three months.

This article first appeared on Quartz.