Some Americans’ finances are on very thin ice.

One in five Americans say they have more credit-card debt than they do in emergency savings, according to a report published Thursday from the personal-finance company Bankrate. Another 12% said they had no credit card debt, but they also had no savings. Bankrate surveyed 1,000 people during early February.

But the report isn’t all bad news. More than half (58%) said they had more in emergency savings funds than in credit-card debt, the highest percentage Bankrate has ever had, tied with the amount who said this in 2015.

Financial experts typically recommend that all consumers have three to six months’ worth of expenses saved in an easy-to-access emergency fund, to guard against any unexpected expenses. Bankrate did not ask exactly how much those surveyed had saved.

“We’re seeing progress,” said Greg McBride, chief financial analyst at Bankrate. “Unemployment is coming down, people are making more money, and they’re finally making progress on right-sizing the equation between credit-card debt and emergency savings.”

4 things rich people do with their money that you should be doing too

Millennials were actually standouts for their good savings behavior, McBride said. Some 61% of millennials said they had more emergency savings than credit-card debt. Just 54% of the members of Generation X said they had more, compared to 56% of baby boomers and 67% of members of the Silent Generation.

Millennials may be doing a good job saving because they had “a front row seat for the financial crisis,” he said. It can be tempting to pay down debt rather than save, but consumers really have to do both, McBride said. “That lack of savings can lead to even more debt.”

Consumers trying to build an emergency fund should set up an automatic savings plan, he said. That will put a certain percentage of their paycheck into a savings account. After determining the amount they can put in that fund for each paycheck, they can then pay debt with whatever funds they can spare in their budget.

“Saving is all about establishing a habit,” he said.