It’s no secret that there have been a ton of flight cancellations and delays this year. I’ve heard so many horror stories of people stranded at the airport, or thwarted from their long-awaited vacations by bad weather, pilot/mechanic shortages, or aircraft malfunctions. As a frequent flier, I’ve learned over the years what to do, what not to do, and what you are legally entitled to when your flight is delayed or canceled.

My first bit of advice is to be prepared: it can save you a ton of time and energy if you know ahead of time that your flight is delayed or canceled! First, download your airline’s app as soon as you book your ticket. These apps are helpful anyway because you’ll get notifications, live tracking, and updates pre-flight. Most importantly, you can view flight schedules and reschedule flights as soon as you see something wrong. The app/website FlightAware is also an excellent tool for tracking the real-time status of planes in the sky and on the ground.

Knowing ahead of time is great, but let’s face it: things happen, and sometimes you just won’t know the bad news until you get to the airport. Here are five things to know when your flight is delayed or canceled:

1. Don’t rush the gate!

As soon as news of a delay or cancellation breaks, people swarm the gate desk. Avoid the long line at the gate desk and go instead to the terminal’s main info desk, check the airline’s app or in-airport kiosk, get help at the airline’s lounge (if you have access), or take to Twitter! You can even try calling the airline’s home line (if they’re located in another country, like Germany’s Lufthansa.) These home lines tend to be better staffed than the U.S. lines, and you can use a free app like Skype to call internationally, toll-free.

2. Don’t rebook yourself unless absolutely necessary

In the case of a delay, your ticket is still active and the airline will rebook you on a later flight. Unless you absolutely cannot wait and MUST get home that day, don’t rebook yourself on a new flight/reservation! Travel insurance and credit card protection programs won’t reimburse you in these situations. If the flight is officially canceled, be sure to ask if the original airline can transfer you to another carrier BEFORE you book a new reservation. If there are available seats and you’re early enough, this is definitely possible.

3. Ask if hotel/meals will be covered

Contrary to popular belief, airlines are NOT required to provide hotel/meal vouchers if a flight is canceled or delayed (although some of the better airlines will.) However, remember that travel insurance and many credit card companies like Chase, Amex, and Capital One offer cards that will reimburse you for hotel/meals if you find yourself in that position AND you booked the flight on that card. That’s just one more good reason to have one (or more) of these cards!

4. Book a hotel room ASAP

That said, if you have to wait overnight for the next flight, book a room at the airport hotel as soon as you possibly can. Those rooms are going to fill up fast – and trust me, sleeping at the airport is not fun.

5. Ask for a refund – you’re entitled to it!

If your flight is officially canceled: in the U.S., you are legally entitled to a refund if your domestic OR international flight to/from the U.S. is canceled. You’re also entitled to a refund for extra services like baggage fees, seat upgrades, etc.! Unless they offer you a sweet bonus, don’t accept the airline’s voucher for another flight. Those often have a short expiration date and caveats that make them difficult to use. Unfortunately, many airlines are going to make it difficult for you to get a refund, even though it’s the law. If an agent tells you no, cite the Department of Transportation’s law – and call back/try again later if need be. If they absolutely continue to refuse, dispute the charge on your credit card and report the airline to the DOT.