How can I talk to my ex about what he says around our son?

I need some advice on how to handle a couple different situations in regards to my ex husband and our son. My son (4 years old) came home from his dads yesterday, and we were out eating lunch at a restaurant and the waitress came and asked us if we needed anything else, to which my son said “you’re a b**** !”. I promptly grabbed him and made him go apologize to her. I asked my son later where he learned that from and he said his dad and that he let’s him say it. Me and my current SO have had issues before with him coming back from his dads and dropping the F bomb repeatedly. And we got the same story about his dad let’s him say it at his house. I know my ex husband, and I know if I ask him about it he’s going to deny everything to do with it. My SO had a talk with him later that day explaining why we don’t say things like that and we don’t ever talk to women like that. My ex unfortunately talked to me like that for years and so I know that’s where its coming from… Any advice on how to handle it?? Secondly, my son has also came home from his dads the last 2 times and been talking about mine and my ex husbands divorce. And I don’t mean the fact that we were married at one point, I mean him saying things that should not have been told to a 4 year old or even said in the presence of. I understand explaining to him that mommy and daddy aren’t together anymore but the specific details are something that I don’t think he should know, especially at this age. If he was older (teenager-ish) i would be more understanding. But the same situation with the cursing, I’m basically going to be beating a dead horse trying to talk to my ex about anything. Advice on this would be welcome too…