Most people have thoughts and dreams about how their lives ought to be. When things don’t work out the way they had pictured, they tend to blame other people or situations.

They don’t realize that the bad feelings come from their own thinking.

“When things are bad, people say to themselves, ‘Things aren’t the way I like them,’ and then say, ‘That’s terrible, that’s awful’—meaning they think things are so bad that they shouldn’t or mustn’t be that way,” says Albert Ellis, PhD, the creator of Rational Emotive Behavior Therapy and author of Feeling Better, Getting Better, Staying Better.

It’s normal, however, to have to deal with difficult situations and difficult people as you go through life.

Here’s how to change your thinking, so you can feel good when your life isn’t perfect.

Unconditionally accept yourself

Most people want to do well in order to feel good about themselves and be loved by the significant people in their lives. But this way of thinking can make you feel crazy.

“It’s important to accept yourself whether or not you do well and whether people who are important to you love you,” says Dr. Ellis. “Don’t think, ‘I have to do well,’ because then, if you don’t, you’ll worry. Instead, just prefer to do well. Even when people are doing well and being loved by significant people, they worry about tomorrow.”

Don’t over-generalize

You can evaluate what you think, feel and do, but don’t give yourself a generalized rating. You’re like a diamond in the making and have many facets. Some shine brilliantly, and others still need to be polished.

“People generalize and say, ‘I failed a few times, and I might fail again.’ That’s true enough, but then they stupidly over-generalize and say, ‘I failed a few times, and I’m a failure.’ You can’t be a failure or a success,” says Dr. Ellis. “But you can fail at things and be successful at things.”

Even evaluating yourself as a good person creates stress, because you’ll always have to live up to your image and do good things. The truth is that you do thousands of things—some good, some bad.

Unconditionally accept others

You may get angry with relatives, friends, co-workers or other people because of things they’ve done. You’ll feel far less miserable if you feel disappointed, instead.

“You can think, ‘I don’t like their behavior, but they’re fallible humans who sometimes do good and sometimes behave badly. I can accept them and not make myself incensed or furious at them.'” says Dr. Ellis. “You can judge their behavior as bad or wicked, but never judge them, as people, as bad, evil or rotten.”

This doesn’t mean you should tolerate bad behavior. You can still try to get them to change how they behave, but you can do it without anger.

Unconditionally accept life

Many bad things may happen to you in your life, but you don’t have to view them as terrible, because you can handle them and even be happy in spite of them. Therefore, it’s not the bad things that upset you—it’s your view of them.

Feeling bad comes from demanding that something turn out a certain way.

“A demand says, ‘I have to have something, or to have something turn out a certain way, and it’s terrible and I’m no good if I don’t have it,’ ” says Dr. Ellis. “You don’t need life to be good. It’s preferable, of course—highly preferable—but it’s not a necessity.”