Being laid off for months can be really scary, especially if you’re the sole earner in your family. It’s an even more frightening situation if you are at risk of losing the house you’ve worked so hard for.

Don’t miss

The good news is if you’re 60 days late on mortgage payments, you’re typically not going to be at serious risk of foreclosure yet. The Consumer Financial Protection Bureau (CFPB) says generally lenders can’t start the process until you’re 120 days late. Foreclosures are also usually the last resort for lenders.

If you’re going to be starting a new job soon, you hopefully have options to get back on track with your home loan before that happens.

Still, there’s a chance your lender will act, and you also face serious damage to your credit when you’re behind, as your record of late payments will stay on your credit report for up to seven years, according to Experian. Plus, you’re in a pretty stressful spot that may damage your mental health.

Here’s how to cope in this difficult situation, as well as some steps you can take to try to make sure you don’t face a similar issue in the future.

What can you do if you’re behind on your mortgage payments?

If you’re behind on your mortgage payments, your options vary depending on whether you have money to pay something now, or at least soon, and how much your lender will work with you.

If you don’t have the money to make payments now but will be employed soon, you have more options than if you can’t afford to make any payments at all for the foreseeable future

In either situation, the best option is to contact your lender ASAP. As the CFPB explains, you should have information ready to share, including:

Your lender may grant you relief by offering forbearance or restructuring your loan to make future payments more affordable. In most cases, lenders will work something out if they can because they want to avoid foreclosing, which takes money and time. However, you must be able to pay something, or have a plan to pay soon.

If you don’t think you’ll be able to pay anything for the foreseeable future, selling your house could be best before you fall too far behind. You’ll have to be able to sell for enough to pay off the loan, though, because otherwise your lender would have to agree to a short sale (accepting less than the amount due) or you’d have to pay the difference. Since in some states the lender can sue you for the deficiency after the short sale, the CFPB advises getting a waiver in writing.

Read more: You don’t have to be a millionaire to gain access to this $1B private real estate fund. In fact, you can get started with as little as $10 — here’s how

Be aware of closing costs that can be 6% or more of your sale price and must be covered from the proceeds or from your bank account.

The good news is, if you’re expecting to get back to work soon, you may not have to sell and incur transaction costs or potentially lose a low mortgage rate. You may just be able to arrange a payment pause, and whether you make a deal or not, if you resume your payments before you’re 120 days or more behind, you should still be able to avoid foreclosure starting.

How to cope with the mental stress of being in debt

It’s understandable to be pretty stressed about your situation if you’re unemployed — especially when you’ve fallen behind on the bills. Research shows that unemployment increases the risk of a variety of mental health disorders, including anxiety, depression, drug use, and even eating disorders. Obviously, you’ll want to try to find positive ways to cope.

Working out a plan for your financial situation, including talking to your lender, will help a lot with your stress since you won’t be so afraid of foreclosure if you’ve talked with your creditors and they’ve agreed to a plan for your situation.

The University of California, Berkeley also recommends communicating with loved ones about your situation and your worries, joining a job-seekers support group, clarifying your greatest fears and proactively addressing them, and making sure to get enough sleep, as well as exercising and eating well.

By taking these steps, you can hopefully get through this troubled period and emerge from unemployment feeling good about your situation and able to get back on track financially.

How to prepare for a layoff

You’ve already lost your job and are dealing with the aftermath, but after you get back to work, you can take steps to reduce the damage that any future unemployment can do. This includes:

Since your late mortgage payments will likely damage your credit, it’s going to be especially important to focus on earning a good score again in the future. Getting current on all past due bills, maintaining low balances on your credit cards, and paying on time for the future will help you earn good credit again over time.

What to read next

Money doesn’t have to be complicated — sign up for the free Moneywise newsletter for actionable finance tips and news you can use. Join now.

This article provides information only and should not be construed as advice. It is provided without warranty of any kind.