diff --git a/src/scripts/model_maker.py b/src/scripts/model_maker.py
index 9705290efc8b30736c79c18bc1a62d4cbea5b304..10b10d0fbd4c78c0fdb4c81f298b09e2dab7f2ca 100755
--- a/src/scripts/model_maker.py
+++ b/src/scripts/model_maker.py
@@ -523,15 +523,22 @@ def write_legacy_sconf(conf):
     else:
         str_line = "{0:.3E}  {1:.3E}\n".format(conf['xi_start'], conf['xi_step'])
         output.write(str_line)
-    sphere_count = 0
+    sphere_line_count = 0
+    placed_spheres = 0
+    last_type = 0
+    dedfb_type = 0
     for si in range(nsph):
-        str_line = "{0:5d}".format(conf['vec_types'][si])
+        if (conf['vec_types'][si] > last_type):
+            dedfb_type = placed_spheres + 1
+            last_type = conf['vec_types'][si]
+        str_line = "{0:5d}".format(dedfb_type)
         output.write(str_line)
-        sphere_count += 1
-        if (sphere_count == 16):
+        sphere_line_count += 1
+        placed_spheres += 1
+        if (sphere_line_count == 16):
             output.write("\n")
-            sphere_count = 0
-    if (sphere_count != 0):
+            sphere_line_count = 0
+    if (sphere_line_count != 0):
         output.write("\n")
     for ci in range(conf['configurations']):
         layers = conf['nshl'][ci]