Scientists have identified what might be the worst kind of boss to work for, and it’s not the one that is mean to employees all the time.

The researchers say a boss who has mood swings, ping-ponging between positive and negative treatment, creates more tension in the office environment, according to a study in the Journal of Management. That’s compared to a boss who is nasty all the time, giving employees an opportunity to develop a clear hatred for the manager.

When a boss sometimes treats employees well and sometimes does not, the workers become ambivalent in their opinion of that unpredictable leader and their work performance suffers.

The researchers’ conclusions were based on data from employee surveys.

“Far from the stereotypical view that ruthless and unsympathetic managers cause the greatest issues for employees … bosses who switch between being friendly and severe at the drop of a hat are actually most damaging,” the University of Exeter said in a statement. “Experts found even a poor but consistent relationship with managers was better for workers than one that was influenced by mood swings.”

A good relationship with coworkers, however, could improve matters because of the support those relationships offer.

“The focus is usually on trying to work out if relationships between staff and bosses are good or bad, but they can sometimes be both, and it is important to measure that,” researcher Allan Lee said in the statement. “Bosses reward and punish their workers, and this has an impact on self-esteem. If their staff have to adopt different roles at different times because they have a manager who can be both nasty and nice, they view him or her in an ambivalent way.”

But having a more stable view of the boss, positive or negative, is better for productivity.

“If your boss is both pleasant and unpleasant to be around it is hard to know what they think about you, and if you can’t predict how they will act,” Lee said. “This makes it hard to trust them. This creates negative emotions and makes staff feel anxious, causing poor performance at work.”

Bosses affect their employees in many different ways. Apart from creating certain work environments that can affect mental health, sometimes a boss’ behavior can rub off on others. Recent research suggested that people who work under a manager with psychopathic or narcissistic personality traits have a tendency to feel more depressed and to behave poorly in the office themselves.

Psychopathic personality traits could cause someone to act impulsively and aggressively without empathy; lie or manipulate others; and be self-centered and arrogant, although they may sometimes come off charming. On the other hand, people with narcissistic traits tend to be vain and selfish, craving admiration and having a need to feel superior to other people.