Those who are near retirement are especially vulnerable to drops in the stock market, due to the lack of time they have to recover and the fact that–in the case of those already retired–they’re drawing down savings instead of working and adding to it. But if you plan ahead, you can build a financial buffer to help ensure you survive the passing storm and enjoy your hard-earned retirement.

“A recession will happen,” says Patti Black, certified financial planner and partner at Bridgeworth, a wealth management firm located in the Birmingham, Al. area, citing research that there have been 33 recessions since 1854. “I don’t have a crystal ball to know when it will happen, but it will happen again. So it is super important to be prepared, especially for people who are closer to retirement age.”

This message isn’t a scare tactic. In fact, it’s just the opposite: Acknowledging a recession is inevitable at some point allows you to take control of your own retirement even when markets spin out of control. On average, recessions tend to last about 18 months. To protect your retirement nest egg, here are a few basic steps you should take:

Build Your Cushion

“If you commit to an emergency fund, it protects the rest of the financial plan,” says Sharon Allen, CEO and co-founder of Sterling Wealth Management based in Champaign, Ill. She suggests a minimum of three to six months’ expenses for this fund. It doesn’t matter how solid your retirement plan is if you break it by taking your money out of the market prematurely.

Once you’ve filled that emergency savings bucket, aim to pay down as much debt as possible. That’s key to feeling secure once you leave the workforce, because it means that less of your retirement funds are tied up in fixed expenses, Black says. It’s much simpler to adjust your discretionary expenses as needed.

“It’s easier to say, ‘I’m not going to take a vacation or I’m not going to go out to eat as much,” says Black. “Those are the variable expenses where you can make changes more easily than saying ‘Hey, I’ve decided I’m not going to pay my mortgage this month.’ That doesn’t work out so well.”

Generally, it’s a good idea to tackle your highest interest-rate debt first. Financial advisors are divided on whether you should pay off your mortgage before retiring. Black’s opinion? “If the only choice of funds to pay down the mortgage is a retirement account (IRA or 401k), I don’t recommend proceeding with paying off the loan.” The money you withdraw from your traditional retirement accounts will be counted in your taxable income for the year, and, if you’re on Medicare, could affect what you pay in premiums.

Tweak Your Asset Allocation

If you’re on the cusp of retirement or have just retired, consider diversifying and rebalancing your portfolio to limit your exposure to market volatility.

“It’s really important that people scrub their portfolios of unnecessary risk,” Teresa Ghilarducci, labor economist and expert on retirement security, tells MONEY. “If you’re going to need your money within five years, I recommend putting it into a much safer portfolio.”

“In a recession, if you’re pulling money out of investment accounts that you need to live on, you want to be pulling from the bond side,” so you can leave your stocks alone and allow them to recover, says Black.

This approach doesn’t involve becoming conservative with your entire portfolio, however. Traditional wisdom has suggested slashing stock holdings in retirement, but these days plenty of advisors disagree with that advice. Nailing the right balance of stocks and bonds matters more than ever, as life expectancy and health care costs rise. You’ll need stocks’ growth to outpace inflation over time, and that usually means maintaining a healthy equity allocation — Allen recommends in the 60% to 80% range — throughout retirement.

Consider Part-Time Work & Hiring an Advisor

Finding part-time work also helps protect you if a recession catches you off guard. If you’re earning enough income to live on, you can leave your portfolio alone instead of withdrawing funds on a declining balance–a surefire way to drain your savings quickly. Just be aware of how this extra income could affect the taxation of your Social Security benefits, if you’ve already claimed.

Tax considerations aside, the advantages of working in retirement aren’t just financial. Having a job or a hobby gets you out of the house, helps keep your mind sharp and offers you the opportunity to socialize and make meaningful connections within your community.

“I met a retiree a few weeks ago who was working as a school bus driver,” Black says. “It gave him summers off, it wasn’t a time commitment for him and it’s just a little cash that can come in handy when the markets are going crazy and you don’t want to pull out your normal withdrawals. You want to let that money continue to stay in and rebound.”

Lastly, consider finding someone you trust. While it may feel as if you’re wasting money paying a financial advisor, one key to surviving a recession is to avoid reacting emotionally to the ups and downs of the market, something that can be especially fraught for retirees who know they have less leeway to make up their losses. A professional can prevent you from making any rash moves.

“Part of the benefit that we provide is helping people stay in the market when it does go down,” Black explains. “It’s that person in your life telling you, hang in, stay in your seat on the rollercoaster, we’re about to get over this hump, you can do this.”

And if you’re behind the eight ball, know that it’s never too late to start preparing for retirement, regardless of the economic climate, says Allen of Sterling Wealth Management.

“Your investment allocation may look different, and your flexibility may be less in terms of lifestyle if you wait too long to start investing, but it’s better to start period than to never start at all.”