diff --git a/pelix/framework.py b/pelix/framework.py
index <HASH>..<HASH> 100644
--- a/pelix/framework.py
+++ b/pelix/framework.py
@@ -1065,11 +1065,10 @@ class Framework(Bundle):
         # Notify listeners that the bundle is stopping
         self._dispatcher.fire_framework_stopping()
 
-        i = self.__next_bundle_id
-        while i > 0:
-
-            bundle = self.__bundles.get(i, None)
-            i -= 1
+        bid = self.__next_bundle_id - 1
+        while bid > 0:
+            bundle = self.__bundles.get(bid, None)
+            bid -= 1
 
             if bundle is None or bundle.get_state() != Bundle.ACTIVE:
                 # Ignore inactive bundle
framework.stop() doesn't try to stop "next bid" bundle

Bundle stopping loop starts at "next bundle ID" minus 1