Inter-relation between the four brahmaviharas?
Uppekkha is what is used to straighten Karuna. Not Muditha. Compassion can easily turn into sadness. When that happens you view the situation in terms of Karma and Vipaka: “All beings are the owners of their karma; their happiness and unhappiness depends upon their actions, not on my wishes for them.”

Metta(kindness) can turn into lust when practiced towards attractive women. Then you can use a mental technique like thinking of them as mothers, sisters, daughters or you can meditate on the repulsiveness of the body.