by Maria Puente, USA TODAY

by Maria Puente, USA TODAY

In television, it's never good to end a successful sitcom series with people shouting "Racism!" at you on Twitter.

That's the situation faced by CBS's How I Met Your Mother, which concludes its ninth and final season on March 31 and hoped for a happy swan song. But this week the producers ended up apologizing for offending some Asian Americans with a kung fu homage episode that did not go over well or unnoticed.

In Monday night's episode, the Jason Segel character is trying to learn kung fu moves and his "teachers" are his co-stars - Neil Patrick Harris, Josh Radnor, Cobie Smulders and Alyson Hannigan.

All of these people are white and were dressed up in stereotypical "Asian" attire, in what many suggested was a "yellowface" version of now-derided "blackface" that few showrunners these days would mistake for benign entertainment.

On Twitter, the reaction was immediate and included a hashtag, #HowIMetYourRacism, stuffed with angry comments -- and a few get-over-it comments, too.

The always-helpful BuzzFeed put together a list of the most powerful. Some choice tweets:

"@CBS #Yellowface doesn't get you better ratings, it just makes people want to boycott your network," warned JH Seouljaboy Park.

"people are already claiming asian americans are overreacting. demanding to be treated w/ decency is never overreacting," tweeted E. Jae.

Only a few tweeters took the position of Jake, who said it was no big deal. "Seriously. People are WAY too sensitive these days. GTFO if you're offended. There are way worse things in the world."

But by Wednesday, show execs had capitulated. Co-creator Carter Bays took to Twitter to say, "sorry" in a series of tweets.

"With Monday's episode, we set out to make a silly and unabashedly immature homage to Kung Fu movies, a genre we've always loved. But along the way we offended people. We're deeply sorry, and we're grateful to everyone who spoke up to make us aware of it. We try to make a show that's universal, that anyone can watch and enjoy. We fell short of that this week, and feel terrible about it. To everyone we offended, I hope we can regain your friendship, and end this series on a note of goodwill. Thanks."

The timing of this is unfortunate because today HIMYM could have gotten positive coverage of its finale episode in March, which producers say they actually filmed eight years ago.

The reason: Because the two child actors who were in the opening scenes of the series, where the Radner character is telling the long-winded story of how he met their mother, would grow up and not look the same should the series last beyond a few years, which it did.

So in 2006, Bays and co-creator Craig Thomas brought the young actors in, closed the set to all but one camera operator, and filmed the two-minute climactic scene, afterward swearing the young actors to secrecy.

The rest of the actors will film the rest of the finale next month, but the finale of the finale will be the scenes shot in 2006. Harris said he cornered the producers at an office party recently and badgered them into giving up details.

"It's more complicated than you would assume," Harris said, according to the Associated Press, "and for all of our fans, they won't be disappointed."