diff --git a/src/mol-plugin/behavior/dynamic/custom-props/structure-info.ts b/src/mol-plugin/behavior/dynamic/custom-props/structure-info.ts
index a0a8db2f365d6affd8e365bc24dff94909d92bc4..f144a40cf4b83e608ba4e9c15ae18f5a4731e547 100644
--- a/src/mol-plugin/behavior/dynamic/custom-props/structure-info.ts
+++ b/src/mol-plugin/behavior/dynamic/custom-props/structure-info.ts
@@ -53,12 +53,14 @@ export const StructureInfo = PluginBehavior.create({
         }
 
         private setModelMaxIndex() {
-            const maxIndex = this.maxModelIndex;
+            const value = this.maxModelIndex;
             const cells = this.ctx.state.data.select(StateSelection.Generators.rootsOfType(PluginStateObject.Molecule.Model));
             for (const c of cells) {
                 const m = c.obj?.data;
                 if (m) {
-                    Model.MaxIndex.set(m, { value: maxIndex }, maxIndex);
+                    if (Model.MaxIndex.get(m).value !== value) {
+                        Model.MaxIndex.set(m, { value }, value);
+                    }
                 }
             }
         }
diff --git a/src/mol-theme/color/model-index.ts b/src/mol-theme/color/model-index.ts
index db65a343aae001d1672dad0c6caad093b7297cd7..cbdfd683f10abebf07ceee1ba180b57331440ce0 100644
--- a/src/mol-theme/color/model-index.ts
+++ b/src/mol-theme/color/model-index.ts
@@ -31,7 +31,7 @@ export function ModelIndexColorTheme(ctx: ThemeDataContext, props: PD.Values<Mod
 
     if (ctx.structure) {
         // max-index is the same for all models
-        const size = (Model.MaxIndex.get(ctx.structure.models[0])?.value || -1) + 1;
+        const size = (Model.MaxIndex.get(ctx.structure.models[0]).value ?? -1) + 1;
 
         const palette = getPalette(size, props);
         legend = palette.legend;