If you hit the wall in your last marathon, you’re in good company. According to one study, 43 percent of runners hit the wall in any given marathon. It makes sense, right? Running 26.2 miles is a huge undertaking. What makes it so challenging to run a solid marathon is that the wall is not a single thing. You can run out of steam in the late miles for any of a number of reasons.

Solving the marathon puzzle requires that you identify the specific reason you hit the wall and address it in the next one. Let’s look at six common causes of hitting the wall and how to avoid them.

1. You overemphasized the long run in training.

A marathon is a long race, and you have to do some long training runs to avoid fading in the late miles. But what’s even more important is the total amount of running you do. A study by Ron Maughan, PhD, of Scotland’s Aberdeen University found that average weekly training mileage was a much better predictor of performance in a marathon than the longest distance of a single training run.

If you seldom or never ran more than 40 miles or five times in a week before your last marathon, consider bumping up your average weekly mileage the next time around. And even if you ran more than 40 miles per week, a modest increase in overall training volume may be the key to avoiding another encounter with the wall.

READ MORE: Train Fast and Slow for Race-Day Success

2. You set an overambitious goal or started too fast.

Many runners set marathon time goals on the basis of their performance at shorter distances, and there are various calculators available for this purpose. These tools tend to work pretty well up to the half marathon. For example, if you plug a recent 5K time into one of them, the predicted 10K and half-marathon times it comes back with will likely be realistic for you. But few runners are able to hit predicted marathon times, because the calculators assume commensurate preparation for all distances. In other words, they assume you will be as well prepared for the marathon as you were for the shorter race you used as the basis for your marathon goal, and this is rarely the case among recreational racers, who tend to train more or less the same for races of all distances.

Thus, when runners start a marathon at the pace that one of these calculators assures them they can sustain for 26.2 miles, they tend to hit the wall. And even when runners base their marathon goal on other targets (such as round numbers and Boston Marathon qualifying standards), they very often start too fast and fade.

The best way to avoid this situation, according to Hoka One One Northern Arizona Elite coach Ben Rosario, is to choose a marathon goal that represents the fastest pace you are 100 percent certain you can sustain for the full distance based on your recent training and prior marathons you’ve done. If it turns out you can go a little faster, you’ll know this by 18 or 20 miles and it won’t be too late to speed up a bit and still run the fastest time you were capable of that day.

READ MORE: 4 Keys for Not Starting a Race Too Fast

3. You forgot to carbo-load.

Thanks to the anti-carb movement, many runners these days avoid carbo-loading (i.e., increasing their carbohydrate intake) before marathons. This is unfortunate, because carbo-loading is a potent way to avoid hitting the wall.

This was shown in a study conducted by Trent Stellingwerff of the Canadian Sports Centre in Victoria. Stellingwerff tracked the diets of 257 runners during the final five weeks before the 2009 London Marathon. Only 31 of these runners met established targets for carbohydrate intake on the last few days before the race (more on this below). Those 31 runners were duly rewarded, completing the marathon on average 13.4 percent faster than a group of runners matched for gender, age, body weight, training volume, and marathon experience. Most of this difference came in the final 4.5 miles, where the runners who had eaten fewer carbs the day before hit the wall and slowed down precipitously and the runners who had carbo-loaded properly slowed down much less.

Carbo-loading is easy: Just aim to get 70 percent of your total daily calories from carbs for the last three days before your marathon.

READ MORE: Experts Tips for Optimal Race-Day Fueling

4. You under-fueled during the race.

Failure to consume adequate amounts of carbohydrates during a marathon is even more common and detrimental than failure to carbo-load. How much faster could you cover 26.2 miles if you got enough carbs? An answer comes from a 2014 study conducted by researchers at Denmark’s Aalborg University. Twenty-eight runners training for the Copenhagen Marathon were separated into two groups of equal ability based on their performance in a 10K time trial. On race day, one group used their own freely chosen fueling plan while the other group consumed carbs on a schedule of 60 grams per hour, which prior research indicated was optimal for endurance performance.

On average, the runners who executed their own freely chosen fueling plan took in 38 percent less carbohydrates during the race. They also finished an average of 10:55 or 4.7 percent slower than the runners of equal ability who fueled scientifically.

Want to lessen you chances of hitting the wall in your next marathon? Take in 60 grams of carbs per hour!

READ MORE: Are You Under-Fueling or Over Training?

5. You forgot to strength train.

 The phenomenon of local muscle fatigue is an underappreciated contributor to hitting the wall in marathons. Although we tend to think of fatigue as a general depletion of bodily energy, some of the individual muscles that work the hardest during running, such as the shock-absorbing quadriceps, lose their force-generating capacity faster than other muscles. When this happens, your stride becomes less economical, and as a result it takes more and more energy to sustain the same pace.

A 2011 study by researchers at England’s Northumbria University found that runners who scored higher on tests of muscular endurance lost their economy more slowly during a hard run. Running itself builds muscular endurance to a certain degree, but a regular strength-training program will make you more resistant to this particular cause of hitting the wall.

Be sure to include exercises specifically designed to enhance muscular endurance in your gym workouts. Examples are high-repetition strength exercises such as 20 repetitions of stability ball hamstrings curls and long-hold isometric exercises such as a side plank held for 60 seconds.

READ MORE: How Runners Can Get Stronger

6. You let negative thoughts get the best of you.

When you begin to slow down in the late miles of a marathon, it feels inexorable, as though you have no choice. But that’s not true. While physical factors certainly do contribute to the wall, the direct causes of slowing down are perceptual: specifically, effort and pain. A runner who is good at dealing with the discomfort of the marathon is less likely to slow down near the end of the race than is a runner who is less resilient—even when their effort and pain levels are identical.

When you’re suffering in the late going of a marathon, it’s natural to think negative thoughts (e.g., “I just don’t have it today.”). But research has shown that such thoughts have a detrimental effect on performance that is completely independent of physical fatigue, and that consciously replacing such thoughts with positive alternatives (“Relax, you’ve been here before.”) enhances performance.

In a 2013 study, Samuele Marcora and colleagues at the University of Kent in England subjected twenty-four subjects to an endurance test and then separated them into two groups of 12. One group received training in positive self-talk and the other did not. When the endurance test was repeated two weeks later, the group that had been taught to practice positive self-talk performed 17 percent better while the control group showed no improvement.

Don’t neglect your mental game in training for your next marathon. Practice swapping out negative self-talk with positive thoughts in tough workouts so it comes naturally on race day.

READ MORE: Boosting Mood and Performance with Mindfulness