Are you absolutely positive all newly added tags have full collection of flags supplied? The 'random change' in my experience happens when a graphic file (in this case, a flag) is missing as far as engine is concerned (wrong format, wrong assignment, plain missing etc) and the engine in such situation simply reuses whatever other graphics it used right before. Which leads to units which don't have "their own" graphics seemingly switching flag/type, because the symbol they receive keep changing, because the 'last used graphic' keeps changing.
yeah Killerrabbit knows how to fix that, not a bug with the game i don't think.