The misery of a measles outbreak at the Happiest Place on Earth is an irony even the most jaded epidemiologist could do without, but the 52 cases that originated in Disneyland in December hide within them an even scarier number—scary, that is, unless you understand how vaccines work.

Now, plainly, most of the people stricken with Mickey Mouse measles do not understand how vaccines work, because they didn’t get them. The vast majority of the infected were unvaccinated against the disease, including kids who were too young for the shots and anti-vaxxers who chose against them. That’s how you get an outbreak. But six of the cases got their measles-mumps-rubella vaccine—the MMR shot—and still managed to get infected. And all but two of them had gotten at least two doses, the standard recommendation.

So what happened?

A crowd of people disperses after watching a parade at Disneyland in Anaheim, California on Thursday, Jan. 22, 2015. Jae C. Hong/AP

The measles vaccine is actually one of the most effective vaccines in the world. According to Greg Wallace, lead of the measles, mumps, rubella and polio team at the CDC, two doses are 97 percent effective against infection. (Compare that to 88 percent for two doses of the mumps vaccine from the MMR shot.) It’s a live version of the virus, just weakened—or attenuated—so it doesn’t cause severe symptoms. The vaccine replicates just like the full-on measles virus, inciting your immune system to produce antibodies against it. Those antibodies then protect against actual measles as well.

But in some people, that response just doesn’t happen. No one knows why. Either your body doesn’t produce enough antibodies, or the ones it does produce aren’t specific enough to latch on to the virus and kill it.

That’s why the CDC recommends two doses of the vaccine: After the first dose, 5 to 7 percent of people won’t have a good enough antibody response to protect them. A second dose ensures that enough people get antibodies above that protective threshold to control the disease. "And even with two doses, you can get some failure," says Wallace, "whether it's because the initial response isn't perfect, or because the response waned in some people."

So how does that explain what happened in Disneyland? If you have a group of 1,000 people concentrated in a small space—like oh, say, hypothetically, an amusement park—about 90 percent of them will be vaccinated (hopefully). One person, maybe someone who contracted measles on a recent trip to the Philippines, moves around, spreading the virus. Measles is crazy contagious, so of the 100 people who aren’t vaccinated, about 90 will get infected. Then, of the 900 people who are vaccinated, 3 percent—27 people—get infected because they don't have full immunity.

Now the Disneyland numbers—six vaccinated infections out of the 34 cases with known records—start to make more sense. (And considering the 16 million or so visitors the park gets every year, we might reasonably expect that number to go up.) Once vaccination levels dip below 90 or 95 percent, there aren’t enough protected people to keep the disease in check—the herd immunity that epidemiologists like to talk about so much. In the US, we’ve been doing pretty well keeping those numbers up. “But there are some fluctuations,” says Cristina Cassetti, program officer at the National Institute of Allergy and Infectious Diseases, “and if vaccination levels dip down a little, you get a situation like Disneyland.”

So, the tiered model of antibody response leaves a small percentage of vaccinated people susceptible. But note: It’s also the reason why you’re better off being vaccinated even if you end up getting infected. Your antibody levels might not be high enough to completely protect you, but they’ll still help—the CDC has seen vaccinated patients with measles who only get a rash for about an hour, says Wallace. And, importantly for octogenarians (whose immune systems are weaker) and infants, vaccinated patients are much less likely to transmit the disease to other people. Even if you’re the unlucky sucker who gets infected after vaccination, getting a shot still helps contribute to herd immunity—good job, world citizen! Taking one for the team!

Researchers are still trying to understand why people’s immune systems respond differently. When they figure it out, it might help them create a more effective version of the vaccine.

But right now, the more important thing to focus on is vaccinating people to keep the disease from spreading like it has in Disneyland. 2014 was a banner year for the measles: 635 US residents were infected, more than the past four years combined. Without a change, those numbers will keep going up.