Americans get bill paying all wrong.

For many Americans, mortgage payments don’t take priority. Fully 40% of Americans think you should prioritize paying your credit card bill before other debts like your mortgage, according to data released Thursday by real estate firm Trulia.com. And when consumers actually get into a tough financial spot, they end up paying personal loans before other debts including their mortgages, according to a study of roughly two million consumers who had four types of debt (personal loans, auto loans, mortgages and credit cards) out in May from credit monitoring service TransUnion.

Bad move, experts say. When you can’t pay all of your bills, focus first on your basic necessities like food and shelter, says Sheri Conklin, a certified financial planner at Conklin Financial Planning in Roseville, Calif. That means your mortgage should be the first thing you pay, she explains. After that, pony up the money for your car loan, as you likely will need this to either get to work or look for work, she says. Credit cards come after that, and in many cases, the personal loan is the last thing you’d pay if you couldn’t pay everything.

Why don’t Americans think to pay the mortgage first? They may believe that it’s hard to get a house taken away, so they don’t prioritize it. And when they’re unable to pay all their bills, something like a personal loan — in which the size of the monthly payment is often smaller (Citi says theirs average about $8,000, for example) than a mortgage, may feel like something a financially challenged consumer can at least manage. Personal loans also tend to have a shorter term than other debts, so people are motivated to pay them because they “feel like they can see a light at the end of the tunnel,” Ezra Becker, senior vice president and head of research for TransUnion’s financial services business unit, tells Moneyish. (Mortgage debt, on the other hand, often goes for 30 years.) “They might say to themselves, ‘I can be done with this’,” says Becker.

What should consumers do if they can’t pay their bills? Kimberly Foss, a certified financial planner at Empyrion Wealth Management, says that first you should remember that “in most states, mortgage lenders are required to extend a grace period–usually 10-15 days–before a payment is counted as late. Many car loans also include a 10-day grace period, but this varies by lender.” If that doesn’t help you enough, Conklin suggests you call the company you owe money too and see if they will work something out with you.

This story was originally published in May. It has been updated.