I watched an olden goldie film on tv called Thoroughly Modern Millie - a musical from 1967 with Julie Andrews. It was a lovely film with a hugely racist subplot against the Chinese. The film ended with one Chinese old man as a good guy, someone who had raised the hero of the film since he wa a boy - but it peddled every Chinese stereotype and myth available before it got to that point.
I am guessing that good guy character was added because the makers of the film knew the rest of it was offensive... which is kind of worse. Up until that point in the film, I assumed there must have been some war, some kind of 'problem with China' thing, going on in America at the time, though I couldn't think what... The ending showed that the directors, writers, whoever, knew exactly what they were doing in making a film which had the Chinese as both bad guys and objects of unwitting comedy - but they still chose to do it anyway, pasting an emollient over the whole film by having one amazing Chinese good guy. The film was also an Oscar winner.