diff --git a/package/gluon-client-bridge/luasrc/lib/gluon/upgrade/320-gluon-client-bridge-wireless b/package/gluon-client-bridge/luasrc/lib/gluon/upgrade/320-gluon-client-bridge-wireless
index 3edb39d87b3ccf92d9b35b330f5a29aec5429829..2f07f2b91c8fdef577ca93c998d5e6680437bc6a 100755
--- a/package/gluon-client-bridge/luasrc/lib/gluon/upgrade/320-gluon-client-bridge-wireless
+++ b/package/gluon-client-bridge/luasrc/lib/gluon/upgrade/320-gluon-client-bridge-wireless
@@ -21,21 +21,26 @@ local function configure_client(config, radio, index, suffix)
 
   uci:delete('wireless', name)
 
-  macaddr = util.generate_mac(3*(index-1))
+  if not config then
+    return
+  end
 
-  if config and macaddr then
-    uci:section('wireless', 'wifi-iface', name,
-      {
-        device = radio,
-        network = 'client',
-        mode = 'ap',
-        ssid = config.ssid,
-        macaddr = macaddr,
-        ifname = suffix and 'client' .. suffix,
-        disabled = disabled,
-      }
-    )
+  macaddr = util.generate_mac(3*(index-1))
+  if not macaddr then
+    return
   end
+
+  uci:section('wireless', 'wifi-iface', name,
+    {
+      device = radio,
+      network = 'client',
+      mode = 'ap',
+      ssid = config.ssid,
+      macaddr = macaddr,
+      ifname = suffix and 'client' .. suffix,
+      disabled = disabled,
+    }
+  )
 end
 
 local function configure_radio(radio, index, config)
diff --git a/package/gluon-mesh-batman-adv-core/luasrc/lib/gluon/upgrade/320-gluon-mesh-batman-adv-core-wireless b/package/gluon-mesh-batman-adv-core/luasrc/lib/gluon/upgrade/320-gluon-mesh-batman-adv-core-wireless
index dd3354de6b63072e8ab9ff77f97144aa37ec60db..bcf1ca0e20682c48771717f85fcd4d942b3b3c5a 100755
--- a/package/gluon-mesh-batman-adv-core/luasrc/lib/gluon/upgrade/320-gluon-mesh-batman-adv-core-wireless
+++ b/package/gluon-mesh-batman-adv-core/luasrc/lib/gluon/upgrade/320-gluon-mesh-batman-adv-core-wireless
@@ -29,46 +29,51 @@ local function configure_ibss(config, radio, index, suffix, disabled)
   uci:delete('network', name .. '_vlan')
   uci:delete('wireless', name)
 
+  if not config then
+    return
+  end
+
   macaddr = util.generate_mac(3*(index-1)+2)
+  if not macaddr then
+    return
+  end
 
-  if config and macaddr then
-    if config.vlan then
-      uci:section('network', 'interface', name,
-        {
-          proto = 'none',
-        }
-      )
-
-      uci:section('network', 'interface', name .. '_vlan',
-        {
-          ifname = '@' .. name .. '.' .. config.vlan,
-          proto = 'batadv',
-          mesh = 'bat0',
-        }
-      )
-    else
-      uci:section('network', 'interface', name,
-        {
-          proto = 'batadv',
-          mesh = 'bat0',
-        }
-      )
-    end
-
-    uci:section('wireless', 'wifi-iface', name,
+  if config.vlan then
+    uci:section('network', 'interface', name,
       {
-        device = radio,
-        network = name,
-        mode = 'adhoc',
-        ssid = config.ssid,
-        bssid = config.bssid,
-        macaddr = macaddr,
-        mcast_rate = config.mcast_rate,
-        ifname = suffix and 'ibss' .. suffix,
-        disabled = disabled and 1 or 0,
+        proto = 'none',
+      }
+    )
+
+    uci:section('network', 'interface', name .. '_vlan',
+      {
+        ifname = '@' .. name .. '.' .. config.vlan,
+        proto = 'batadv',
+        mesh = 'bat0',
+      }
+    )
+  else
+    uci:section('network', 'interface', name,
+      {
+        proto = 'batadv',
+        mesh = 'bat0',
       }
     )
   end
+
+  uci:section('wireless', 'wifi-iface', name,
+    {
+      device = radio,
+      network = name,
+      mode = 'adhoc',
+      ssid = config.ssid,
+      bssid = config.bssid,
+      macaddr = macaddr,
+      mcast_rate = config.mcast_rate,
+      ifname = suffix and 'ibss' .. suffix,
+      disabled = disabled and 1 or 0,
+    }
+  )
 end
 
 local function configure_mesh(config, radio, index, suffix, disabled)
@@ -79,32 +84,37 @@ local function configure_mesh(config, radio, index, suffix, disabled)
   uci:delete('network', name)
   uci:delete('wireless', name)
 
+  if not config then
+    return
+  end
+
   macaddr = util.generate_mac(3*(index-1)+1)
+  if not macaddr then
+    return
+  end
 
-  if config and macaddr then
-    uci:section('network', 'interface', name,
-      {
-        proto = 'batadv',
-        mesh = 'bat0',
-      }
-    )
+  uci:section('network', 'interface', name,
+    {
+      proto = 'batadv',
+      mesh = 'bat0',
+    }
+  )
 
-    uci:section('wireless', 'wifi-iface', name,
-      {
-        device = radio,
-        network = name,
-        mode = 'mesh',
-        mesh_id = config.id,
-        mesh_fwding = 0,
-        macaddr = macaddr,
-        mcast_rate = config.mcast_rate,
-        ifname = suffix and 'mesh' .. suffix,
-        disabled = disabled and 1 or 0,
-        macfilter = macfilter,
-        maclist = maclist,
-      }
-    )
-  end
+  uci:section('wireless', 'wifi-iface', name,
+    {
+      device = radio,
+      network = name,
+      mode = 'mesh',
+      mesh_id = config.id,
+      mesh_fwding = 0,
+      macaddr = macaddr,
+      mcast_rate = config.mcast_rate,
+      ifname = suffix and 'mesh' .. suffix,
+      disabled = disabled and 1 or 0,
+      macfilter = macfilter,
+      maclist = maclist,
+    }
+  )
 end
 
 local function configure_radio(radio, index, config)