diff --git a/info2.cpp b/info2.cpp
index bc8dc98123e9afc69d4a0aec471007740426cf97..6872350611f3e73a8d004081a08fa56daa213d7d 100644
--- a/info2.cpp
+++ b/info2.cpp
@@ -29,16 +29,16 @@ int main(int argc, char *argv[]) {
      */
     int i = 0, i_ = 0, j = 0;
     auto s = scop->statement;
+    osl_statement_p current_scop = NULL;
 
-    auto print_scop = [&s, &i, &i_, &j]() {
+    auto print_scop = [&i, &i_, &j, &current_scop]() {
         std::cout << "scop" << j << ";";
         for(int x = i_; x < i; x++) {
             std::cout << " " << x;
         }
-        std::cout << ";" << s->domain->nb_output_dims << "\n";
+        std::cout << ";" << current_scop->domain->nb_output_dims << "\n";
     };
 
-    osl_statement_p current_scop = NULL;
     while(s) {
         if(!current_scop || !osl_relation_equal(current_scop->domain, s->domain)) {
             /* new scop */