The U.S. loan picture improved slightly during the second quarter, with the amount of loans 90 days or more past due declining for the first time in more than four years, bank regulators said on Tuesday.

The Federal Deposit Insurance Corp revealed some encouraging figures about the bank industry, saying the sector earned $21.6 billion during the quarter largely due to banks putting away less money to cover expected loan losses.

During the first quarter, the industry earned $17.8 billion.

In other signs of improvement, the total assets of banks characterized as "problem" institutions fell during the quarter to $403 billion from $431 billion, and the FDIC's insurance fund increased by $5.5 billion during the quarter.

But there are still troubling indicators.

Loan balances continued to decline during the second quarter, with net loan and lease balances declining by 1.3 percent. Loans to small businesses and farms -- a major focus of the Obama administration -- fell by 1.8 percent during the quarter.

"Earnings remain low by historical standards, and the numbers of unprofitable institutions, problem banks, and failures remain high," FDIC Chairman Sheila Bair said.

While the assets at problem banks declined, the total number of such institutions bumped up to 829 from 775 last quarter.

The FDIC does not disclose the names of the institutions, which regulators have flagged for low capital levels, poorly performing assets and other troubles.

The agency has said the bank failures are expected to peak during the third quarter. So far this year, 118 banks have failed. Last year 140 bank collapsed.

Bair said the FDIC still anticipates that the number of failures this year will exceed last year, but that the total assets of this year's failures will probably be lower.

That is because it is mostly smaller banks that have been failing.

She said economic uncertainties mean banks should continue to exercise caution and maintain strong reserves.

But she also highlighted the industry's gains.

"The banking sector is gaining strength. Earnings have grown, and most asset quality indicators are moving in the right direction, putting banks in a stronger position to lend," Bair said.