diff --git a/geant/gap_ansible/roles/base_config/templates/routers/nokia/ip_prefix_list.j2 b/geant/gap_ansible/roles/base_config/templates/routers/nokia/ip_prefix_list.j2
index 71dbe2276c58fdf7f3b753f631aace92e9f4d7f7..2322d7702a03865a27417ae625902847bf3fc05b 100644
--- a/geant/gap_ansible/roles/base_config/templates/routers/nokia/ip_prefix_list.j2
+++ b/geant/gap_ansible/roles/base_config/templates/routers/nokia/ip_prefix_list.j2
@@ -34,14 +34,14 @@
                 <description>{{ ip_prefix.description }}</description>
                 {% endif %}
                 <apply-path>
+                  {% for ap in ip_prefix.ipv4_apply_path %}
                   <bgp-peers>
-                    {% for ap in ip_prefix.ipv4_apply_path %}
                     <criterion-index>{{ ap.idx }}</criterion-index>
                     <group>{{ ap.bgp_group }}</group>
                     <neighbor>{{ ap.bgp_neighbor }}</neighbor>
                     <router-instance>{{ ap.router_instance }}</router-instance>
-                    {% endfor %}
                   </bgp-peers>
+                  {% endfor %}
                 </apply-path>
             </ip-prefix-list>
           {% endif %}
@@ -52,14 +52,14 @@
                 <description>{{ ip_prefix.description }}</description>
                 {% endif %}
                 <apply-path>
+                  {% for ap in ip_prefix.ipv6_apply_path %}
                   <bgp-peers>
-                    {% for ap in ip_prefix.ipv6_apply_path %}
                     <criterion-index>{{ ap.idx }}</criterion-index>
                     <group>{{ ap.bgp_group }}</group>
                     <neighbor>{{ ap.bgp_neighbor }}</neighbor>
                     <router-instance>{{ ap.router_instance }}</router-instance>
-                    {% endfor %}
                   </bgp-peers>
+                  {% endfor %}
                 </apply-path>
             </ipv6-prefix-list>
           {% endif %}