If you share custody with your ex-spouse, effective co-parenting is a must. In some situations, this can be all but impossible, especially if your former spouse is difficult or unwilling to compromise. To help you improve your relationship and be a better parent to your kids, Medium offers the following advice.

If your ex wants to remain independent in his or her parenting style, you probably find it tough to come to an agreement on anything. While consistency is key when it comes to child-rearing, it can be hard to get the other parent onboard with your rules, especially if you’re stricter in your household. In this case, you may need to be a bit more flexible to find common ground. While you only want what’s best for your kids, you should also work towards decreasing resentment.

You may also bear the brunt of the blame for everything that goes wrong with your child according to your former partner. Your ex may still be spiteful about the break-up, which can lead to accusations that you’re not providing proper care to your child. If you know that you’re doing all that you can to be a good parent, try to let go of any personal attacks that come your way. When debates arise about things like bedtime or school issues, seek to find a solution that works for everyone.

Remember, kids believe their parents are an extension of themselves. When one parent speaks ill of the other children will take it to heart, which can have a negative impact on both parental relationships. If your ex is badmouthing you in front of your kids, it’s time to have a serious discussion. Explain in non-judgmental terms the impact this kind of behavior can have on the whole family. If the behavior doesn’t resolve on its own, speak with your attorney about the possible next steps.