A lot goes into planning a foreign vacation: searching for the best prices on flights and hotels, mapping out which sights to see, packing the right wardrobe. One thing that may not be on your pre-trip to-do list is checking up on your health insurance.

But if you’re 65 and have Medicare, you can’t count on coverage outside of the U.S.

That’s because Original Medicare stops at the U.S. border, in most cases, and not all Medicare Advantage and Medicare Supplement policies extend overseas either.

To protect yourself against crushing medical bills from emergency care if your vacation goes awry, you may need additional insurance. Even then, shopping can be tricky.

Here’s what you need to know before you leave on your next trip.

When Medicare helps out

If you have traditional Medicare, which consists of Part A (hospital insurance), and Part B (medical insurance), your insurance does not cover care or supplies outside the U.S. (though the U.S. includes territories such as Puerto Rico, the U.S. Virgin Islands, and Guam as well as the 50 states and D.C.)

There are a few limited exceptions: You have an emergency in the U.S. but a hospital in Canada or Mexico is closer; you’re traveling through Canada between Alaska and another state when an emergency arises; or you live in the U.S. but a foreign hospital is closer than the nearest U.S. one that can treat you (emergency or not.)

Special rules also apply if you are on a cruise ship and within six hours of a U.S. port. In that case, Medicare may pay.

Plus, even if you have a Medicare prescription drug plan (Part D), Medicare never covers prescriptions that you obtain overseas.

When private policies fill the gap

With a private Medicare Supplement Insurance policy, also called Medigap (which helps with the 20% of costs that traditional Medicare doesn’t cover), you may be in luck.

Certain Medigap plans, specifically those labeled C, D, E, F, G, H, I, J, M, and N, pay for 80% of the cost of emergency care while you’re traveling overseas, up to a lifetime maximum $50,000. You can no longer buy plans E, H, I, and J plans, but if you enrolled in one before 2010, you can keep that coverage.

With a private Medicare Advantage plan, also known as Part C, the same foreign travel exceptions apply as you find with traditional Medicare. Some Advantage plans may offer additional travel benefits, though, so check the details of your policy.

However, with Medicare Advantage traveling within the U.S. could also cost you. These plans will cover emergency care, but may not cover any other kind of treatment outside of your service area. See a doctor for something routine on your cross-country vacation, and the bill may be painful.

Generally, with a preferred provider organization (PPO) Advantage plan, you can visit doctors that are not in the plan’s network, though you may pay more. With a health maintenance organization (HMO) plan, you typically must visit in-network providers.

And if you travel frequently, beware. Some Medicare Advantage plans will drop you if you travel outside of your plan’s service area for more than six months a year.

How to be sure you’re covered

Unless you have a Medigap or Medicare Advantage policy that specifically covers medical emergencies overseas, you need to buy travel insurance to protect yourself.

Comprehensive travel insurance policies, which are the most popular plans, offer the most protection, says Julie Loffredi, the manager of media relations at InsureMyTrip.com. Benefits include trip cancellation and trip interruption coverage, emergency medical evacuation, emergency medical coverage, 24/7 assistance, and lost baggage protection.

Comprehensive plans generally cost between 4% and 8% of your total trip cost, says Loffredi. You can also buy just travel medical insurance, which covers emergency medical expenses, evacuations, and assistance but does not include trip cancellation coverage.

For a $5,000 two-week vacation to Aruba, a comprehensive travel insurance plan will cost a couple in their 50s around $200, says Loffredi. For that, you’ll get up to $50,000 in medical care, $250,000 for medical evacuation, and trip cancellation coverage.

“Generally, travelers can file a travel insurance claim for any doctor or hospital bills during a trip,” says Loffredi.

How you can still be at risk

Keep in mind that a travel insurance policy may have gaps as well. “It’s important to understand what is covered at the time of purchase—not wait until claim time,” says Megan Cruz, executive director of the U.S. Travel Insurance Association.

If a plan says it covers only emergencies, a visit to a doctor abroad for, say, a cough may not be reimbursed. More importantly, even emergency treatment may not be covered if it’s related to a pre-existing condition.

Many travel insurance companies define a pre-existing condition as “any documented treatment, diagnostic test or exam, medical recommendation for tests or exams, or a change in prescribed medicine within the look-back period stated on the plan,” according to InsureMyTrip.com.

When you submit a claim, insurers can check your medical records for a certain window, usually within 60 to 180 days of you purchasing a comprehensive plan or 90 days to three years before your departure date for a medical plan.

Having a pre-existing condition shouldn’t keep you from taking your dream trip to Paris—it’s not hard to get around this limitation. “Travelers can request a pre-existing medical conditions waiver to cover emergencies related to a pre-existing medical condition while on a trip,” says Loffredi.

Most comprehensive travel insurance plans come with a pre-existing conditions waiver at no extra cost, but you must meet certain conditions, including purchasing your policy when you book your trip, or within a certain number of days after your initial deposit, and being fit to travel at that time, says Cruz.

So be sure to check with a travel insurance agent before you book.