We need our habits — life would actually be very complicated without them. Habits help remember to pack lunch boxes for our kids every day, get to work on time, and brush our teeth. Reading the newspaper is a habit; so is watching our favorite show.

The problem is, grabbing a doughnut for breakfast in the morning, hitting the couch after dinner, and that hourly Facebook check are also habits. So, it's clear not all habits are equally good for us.

If you’re going to fall back on old habits —and we all do — they may as well be healthy.

Luckily, the results from a new study suggest that when it comes down to it, a habit is a habit is a habit, and we can replace unhealthy habits with healthy ones. In fact, healthy habits may be the key to creating a healthier life and getting through stressful times. So if you’re going to fall back on old habits —and we all do — they may as well be healthy.

“When we try to change our behavior,” said Wendy Wood, author of the study, “we strategize about our motivation and self-control. But what we should be thinking about instead is how to set up new habits. Habits persist even when we're tired and don't have the energy to exert self-control.”

Wood and her colleagues followed the habits of college kids over the course of a semester, and looked at how their behaviors changed during stressful times, such as exam periods.

Students who routinely ate doughnuts or other pastries for breakfast did so even more frequently when they were stressed, and students who often ate oatmeal ate more of it when they were stressed out. The same was true of non-food based habits, like reading a particular section of the newspaper or going to the gym. Even when short of time during exams, students who often engaged in these activities relied on their habits more when they were stressed.

“You might expect that, when students were stressed and had little time, they wouldn't read the paper at all, but instead they fell back on their reading habits,” Wood added. “Habits don't require much willpower and thought and deliberation.”

The take-home message of the study is that cutting out bad habits is just not enough – we need to replace them with good habits that we can fall back on without even thinking. This piece of advice is often given in the context of addiction, but it also pertains to habits that are not real addictions. The brain is less able to make good decisions when it’s stressed, so we’re more likely to turn to automatic behaviors. And for people who generally struggle with self-control, adding in the good habits is especially important.

“Everybody gets stressed,” adds Wood. “The whole focus on controlling your behavior may not actually be the best way to get people to meet goals. If you are somebody who doesn't have a lot of willpower, our study showed that habits are even more important.”

So swap your daily doughnut for a cup of oatmeal or a fruit salad, or replace your after-dinner TV time with an evening stroll or some yoga in your living room. It may serve you well, whether you’re stressed or not.

The study was carried out at the University of Southern California, and published in the Journal of Personality and Social Psychology.