diff --git a/compiler/src/prog8/compiler/astprocessing/VariousCleanups.kt b/compiler/src/prog8/compiler/astprocessing/VariousCleanups.kt
index a3450ea56..d0ee75e88 100644
--- a/compiler/src/prog8/compiler/astprocessing/VariousCleanups.kt
+++ b/compiler/src/prog8/compiler/astprocessing/VariousCleanups.kt
@@ -149,8 +149,10 @@ internal class VariousCleanups(val program: Program, val errors: IErrorReporter,
                             return listOf(IAstModification.ReplaceNode(expr, compare, parent))
                         }
                     }
-                    if(values.size<3)
-                        return noModifications  // replacement only worthwhile for 3 or more values
+                    if(values.size<2)
+                        return noModifications
+
+                    // replace x==1 or x==2 or x==3  with a containment check  x in [1,2,3]
                     val valueCopies = values.sortedBy { it.number }.map { it.copy() }
                     val arrayType = ElementToArrayTypes.getValue(elementType)
                     val valuesArray = ArrayLiteral(InferredTypes.InferredType.known(arrayType), valueCopies.toTypedArray(), expr.position)
diff --git a/examples/test.p8 b/examples/test.p8
index 4d94aa0ad..e2067571e 100644
--- a/examples/test.p8
+++ b/examples/test.p8
@@ -22,5 +22,8 @@ main {
 
         if w==1313 or w==4242 or w==9999 or w==10101     ; optimize the containment check to not always use an array + jsr
             txt.print("yep4\n")
+
+        if w==1313 or w==9999     ; optimize the containment check to not always use an array + jsr
+            txt.print("yep5\n")
     }
 }