         if let controllerIndex = controllersBeforePop.firstIndex(of: controller) {
             let controllersToPop = controllersBeforePop[controllerIndex..<controllersBeforePop.count]
             
-            controllersToPop.forEach {
+            controllersToPop.reversed().forEach {
                 self.willPopViewController($0)
             }
         }
         
         if let controllers = navigationController.popToViewController(controller, animated: animated) {
-            controllers.forEach {
+            controllers.reversed().forEach {
                 self.didPopViewController($0)
             }
         }

            return controller
        }
                
        let controllersToPop = self.navigationController.viewControllers
        
        controllersToPop.forEach {
            self.willPopViewController($0)

        if controllers.count > 1 {
            let controllersToPop = controllers[1..<controllers.count]
            
            controllersToPop.reversed().forEach {
                self.willPopViewController($0)
            }
        }
        
        if let controllers = navigationController.popToRootViewController(animated: animated) {
            controllers.reversed().forEach {
                self.didPopViewController($0)
            }
        }
