diff --git a/mhcflurry/class1_affinity_prediction/train_allele_specific_models_command.py b/mhcflurry/class1_affinity_prediction/train_allele_specific_models_command.py
index c763b92dc08566113bc594dc04b0e01f2a23fe56..836e4fdc086f4cb18525766a9a37ce72b6906266 100644
--- a/mhcflurry/class1_affinity_prediction/train_allele_specific_models_command.py
+++ b/mhcflurry/class1_affinity_prediction/train_allele_specific_models_command.py
@@ -189,7 +189,8 @@ def run(argv=sys.argv[1:]):
             # Run in serial. In this case, every worker is passed the same predictor,
             # which it adds models to, so no merging is required. It also saves
             # as it goes so no saving is required at the end.
-            for item in work_items:
+            while work_items:
+                item = work_items.pop(0)
                 work_predictor = work_entrypoint(item)
                 assert work_predictor is predictor