Beans are a great and healthy food, but they have one embarrassing side effect – gas. Martha Stewart famously told “Watch What Happens Live” host Andy Cohen that she doesn’t eat beans, so she never passes gas.

Martha was perhaps in denial, because as most of us know, you can’t stop your body producing gas just by cutting out a particular food.

Why do beans make us so gassy when we eat them, though?

First of all, it’s certain types of beans that cause gas, and they belong to the legume family. Legumes are considered to be a type of vegetable, which includes black beans, navy beans, kidney, adzuki, anasazi, fava, lima, green and garbanzo beans, along with black-eyed peas, edamame, split peas, lentils and soy nuts, according to the Mayo Clinic.

Clinical nutritionist and wellness manager Kelly Hogan, from Mount Sinai’s Dubin Breast Cancer Center, says that beans are high in oligosaccharides, which are a kind of starch that our bodies can’t break down in the intestines. The starch reaches the colon, where it is broken down by bacterial fermentation, which produces gas.

There are other foods that are high in oligosaccharides, and these include onions, garlic, leeks, asparagus, artichokes, broccoli, Brussels sprouts and cabbage.

Hogan says that it is possible to make your beans less gassy through changing the cooking process. She recommends soaking dried beans overnight, getting rid of the soaking water, and cooking the beans in a pot of fresh water. This should reduce the amount of oligosaccharides in the beans.

Cooking beans with a type of seaweed called kombu can also reduce the amount of oligosaccharides in the water. Kombu contains an enzyme that helps to break them down. If you’re using canned beans, Hogan says, make sure you rinse them too, as oligosaccharides can leach out into the canning water.

Sadly, however, it’s just not possible to totally avoid gas just by changing the way you cook beans or by avoiding eating them. Dr. Charles Mueller, PhD and clinical associate Professor of nutrition at New York University, explains that gas isn’t just produced from our food, but from air we “swallow”, which is then passed through our GI tract.

Mueller goes on to say that yes, flatulence is embarrassing, but it’s perfectly normal. He says that you should be more concerned if you are not passing gas. If your bowel habits change – cramping, bloating, lots or gas or none at all – and it doesn’t resolve itself quickly, then you should go to see a doctor.