#intentions

My 5yo is repeating bad words. Help!

My 5yo has learned some bad words from older kids but the other day my husband got frustrated with a project he was doing and he said some bad words and my son and I who were downstairs were able to hear them all.
My son was laughing so I told him that his daddy was frustrated and was using words that are not proper to use because he forgot how to breath and calm himself ( I did not know what else to say). How do I handle this?