diff --git a/src/main/java/plugins/adufour/protocols/gui/block/LoopPanel.java b/src/main/java/plugins/adufour/protocols/gui/block/LoopPanel.java
index 68c3cc61f8b8c7b7cb610108fa2d84daad59bad4..7e8c2308f3d763c4705ebe23123a1fd189fdc35f 100644
--- a/src/main/java/plugins/adufour/protocols/gui/block/LoopPanel.java
+++ b/src/main/java/plugins/adufour/protocols/gui/block/LoopPanel.java
@@ -30,20 +30,20 @@ import plugins.adufour.vars.lang.Var;
 @SuppressWarnings("serial")
 public class LoopPanel extends WorkFlowPanel
 {
-    private final Loop        loop;
-    
-    private final JPanel      innerLoopPanel;
-    
+    private final Loop loop;
+
+    private final JPanel innerLoopPanel;
+
     /**
      * Option used in loops
      */
     protected final JCheckBox menuStopOnFirstError = new JCheckBox("Stop on first error");
-    
+
     public LoopPanel(WorkFlowContainer wfPane, BlockDescriptor blockInfo)
     {
         super(wfPane, blockInfo);
         this.loop = (Loop) blockDesc.getBlock();
-        
+
         // create a special panel to receive the loop variables
         innerLoopPanel = new JPanel(new GridBagLayout())
         {
@@ -51,7 +51,7 @@ public class LoopPanel extends WorkFlowPanel
             public void paintChildren(Graphics g)
             {
                 Graphics2D g2 = (Graphics2D) g;
-                
+
                 Point2D p1 = gradient.getPoint1();
                 p1.setLocation(p1.getX() + 1, p1.getY() - 30);
                 g2.setPaint(new GradientPaint(p1, gradient.getColor1(), gradient.getPoint2(), gradient.getColor2()));
@@ -60,17 +60,17 @@ public class LoopPanel extends WorkFlowPanel
                 g2.setColor(Color.gray);
                 g2.drawLine(15, getHeight() - 1, getWidth() - 6, getHeight() - 1);
                 g2.drawLine(getWidth() - 6, 0, getWidth() - 6, getHeight());
-                
+
                 super.paintChildren(g2);
             }
         };
-        
+
         innerLoopPanel.setOpaque(false);
         innerLoopPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 2, 2));
-        
+
         menuStopOnFirstError.addActionListener(this);
     }
-    
+
     @Override
     public void actionPerformed(ActionEvent e)
     {
@@ -78,28 +78,30 @@ public class LoopPanel extends WorkFlowPanel
         {
             loop.stopOnFirstError.setValue(menuStopOnFirstError.isSelected());
         }
-        else super.actionPerformed(e);
+        else
+            super.actionPerformed(e);
     }
-    
+
     @Override
     protected void drawMenu()
     {
         super.drawMenu();
-        
+
         // add an extra option to close the work flow while preserving its contents
         super.menu.add(menuStopOnFirstError);
     }
-    
+
     @Override
     protected void drawContent()
     {
         innerLoopPanel.removeAll();
-        
+
         int nextRow = 0;
-        
+
         // add batch elements (if any) to the loop panel
-        if (blockDesc.getBlock() instanceof Batch) nextRow = drawBatchVariables(nextRow);
-        
+        if (blockDesc.getBlock() instanceof Batch)
+            nextRow = drawBatchVariables(nextRow);
+
         // add other loop variables
         for (Var<?> loopVariable : loop.getLoopVariables())
         {
@@ -107,40 +109,44 @@ public class LoopPanel extends WorkFlowPanel
             if (blockDesc.getBlock() instanceof Batch)
             {
                 Batch batch = (Batch) blockDesc.getBlock();
-                if (loopVariable == batch.getBatchSource() || loopVariable == batch.getBatchElement()) continue;
+                if (loopVariable == batch.getBatchSource() || loopVariable == batch.getBatchElement())
+                    continue;
             }
-            
+
             nextRow = drawLoopVariable(nextRow, loopVariable);
         }
-        
+
         // add the loop panel to the main container
         GridBagConstraints gbc_loop = new GridBagConstraints();
         gbc_loop.anchor = GridBagConstraints.NORTHWEST;
         jPanelContent.add(innerLoopPanel, gbc_loop);
-        
+
         nextRow = drawExposedLinks(nextRow);
-        
+
         drawInnerWorkFlowContainer(nextRow + 1);
     }
-    
+
     private int drawBatchVariables(int row)
     {
         Batch batch = (Batch) blockDesc.getBlock();
-        
+
         // Batch variables (source and element) are drawn in a peculiar way:
         // [source drop zone] [source label] [source editor] [element drag zone]
-        
+
         // create drop zone and editor for the batch source
         Var<?> batchSource = batch.getBatchSource();
-        if (!varDropZones.containsKey(batchSource)) varDropZones.put(batchSource, createVarDropZone(batchSource, true, DragDropZone.LINK_RIGHT));
-        if (!varEditors.containsKey(batchSource)) varEditors.put(batchSource, createVarEditor(batchSource));
-        
+        if (!varDropZones.containsKey(batchSource))
+            varDropZones.put(batchSource, createVarDropZone(batchSource, true, DragDropZone.LINK_RIGHT));
+        if (!varEditors.containsKey(batchSource))
+            varEditors.put(batchSource, createVarEditor(batchSource));
+
         // create drag zone for the batch element
         Var<?> batchElement = batch.getBatchElement();
-        if (!varDragZones.containsKey(batchElement)) varDragZones.put(batchElement, createVarDragZone(batchElement, false));
-        
+        if (!varDragZones.containsKey(batchElement))
+            varDragZones.put(batchElement, createVarDragZone(batchElement, false));
+
         // Draw the first row in a particular way (source => elements)
-        
+
         GridBagConstraints gbc_dropZone = new GridBagConstraints();
         gbc_dropZone.anchor = GridBagConstraints.WEST;
         gbc_dropZone.fill = GridBagConstraints.NONE;
@@ -148,7 +154,7 @@ public class LoopPanel extends WorkFlowPanel
         gbc_dropZone.gridx = 0;
         gbc_dropZone.gridy = row;
         innerLoopPanel.add(varDropZones.get(batchSource), gbc_dropZone);
-        
+
         GridBagConstraints gbc_inputName = new GridBagConstraints();
         gbc_inputName.anchor = GridBagConstraints.CENTER;
         gbc_inputName.fill = GridBagConstraints.HORIZONTAL;
@@ -161,7 +167,7 @@ public class LoopPanel extends WorkFlowPanel
         inputNameDim.height = 20;
         inputName.setPreferredSize(inputNameDim);
         innerLoopPanel.add(inputName, gbc_inputName);
-        
+
         GridBagConstraints gbc_inputComponent = new GridBagConstraints();
         gbc_inputComponent.anchor = GridBagConstraints.CENTER;
         gbc_inputComponent.fill = GridBagConstraints.HORIZONTAL;
@@ -174,7 +180,7 @@ public class LoopPanel extends WorkFlowPanel
         inputEditor.setFocusable(false);
         inputEditor.setPreferredSize(varEditors.get(batchSource).getPreferredSize());
         innerLoopPanel.add(inputEditor, gbc_inputComponent);
-        
+
         GridBagConstraints gbc_dragZone = new GridBagConstraints();
         gbc_dragZone.anchor = GridBagConstraints.EAST;
         gbc_dragZone.fill = GridBagConstraints.NONE;
@@ -182,18 +188,21 @@ public class LoopPanel extends WorkFlowPanel
         gbc_dragZone.gridx = 3;
         gbc_dragZone.gridy = row;
         innerLoopPanel.add(varDragZones.get(batchElement), gbc_dragZone);
-        
+
         return row + 1;
     }
-    
+
     private int drawLoopVariable(int startRow, Var<?> loopVar)
     {
         boolean isLoopInput = loop.getBlockDescriptor().inputVars.contains(loopVar);
-        
-        if (!varDropZones.containsKey(loopVar) && isLoopInput) varDropZones.put(loopVar, createVarDropZone(loopVar, true, DragDropZone.LINK_RIGHT));
-        if (!varEditors.containsKey(loopVar)) varEditors.put(loopVar, createVarEditor(loopVar));
-        if (!varDragZones.containsKey(loopVar)) varDragZones.put(loopVar, createVarDragZone(loopVar, true));
-        
+
+        if (!varDropZones.containsKey(loopVar) && isLoopInput)
+            varDropZones.put(loopVar, createVarDropZone(loopVar, true, DragDropZone.LINK_RIGHT));
+        if (!varEditors.containsKey(loopVar))
+            varEditors.put(loopVar, createVarEditor(loopVar));
+        if (!varDragZones.containsKey(loopVar))
+            varDragZones.put(loopVar, createVarDragZone(loopVar, true));
+
         if (isLoopInput)
         {
             GridBagConstraints gbc_dropZone = new GridBagConstraints();
@@ -204,7 +213,7 @@ public class LoopPanel extends WorkFlowPanel
             gbc_dropZone.gridy = startRow;
             innerLoopPanel.add(loopVar.isEnabled() ? varDropZones.get(loopVar) : new JLabel("   "), gbc_dropZone);
         }
-        
+
         GridBagConstraints gbc_inputName = new GridBagConstraints();
         gbc_inputName.anchor = GridBagConstraints.CENTER;
         gbc_inputName.fill = GridBagConstraints.HORIZONTAL;
@@ -217,7 +226,7 @@ public class LoopPanel extends WorkFlowPanel
         inputNameDim.height = 20;
         inputName.setPreferredSize(inputNameDim);
         innerLoopPanel.add(inputName, gbc_inputName);
-        
+
         GridBagConstraints gbc_inputComponent = new GridBagConstraints();
         gbc_inputComponent.anchor = GridBagConstraints.CENTER;
         gbc_inputComponent.fill = GridBagConstraints.HORIZONTAL;
@@ -231,7 +240,7 @@ public class LoopPanel extends WorkFlowPanel
         inputEditor.setEnabled(inputEditor instanceof JLabel || loopVar.getReference() == null);
         inputEditor.setPreferredSize(varEditors.get(loopVar).getPreferredSize());
         innerLoopPanel.add(inputEditor, gbc_inputComponent);
-        
+
         GridBagConstraints gbc_dragZone = new GridBagConstraints();
         gbc_dragZone.anchor = GridBagConstraints.EAST;
         gbc_dragZone.fill = GridBagConstraints.NONE;
@@ -239,63 +248,71 @@ public class LoopPanel extends WorkFlowPanel
         gbc_dragZone.gridx = 3;
         gbc_dragZone.gridy = startRow;
         innerLoopPanel.add(varDragZones.get(loopVar), gbc_dragZone);
-        
+
         return startRow + 1;
     }
-    
+
     @Override
     public Point getDragZoneLocation(Var<?> output)
     {
-        if (blockDesc.isCollapsed()) return super.getDragZoneLocation(output);
-        
+        if (blockDesc.isCollapsed())
+            return super.getDragZoneLocation(output);
+
         if (loop.isLoopVariable(output))
         {
             DragDropZone dz = varDragZones.get(output);
-            int x = dz.getLocationOnScreen().x - innerFlowPane.getLocationOnScreen().x;
-            int y = dz.getLocationOnScreen().y - innerFlowPane.getLocationOnScreen().y;
-            return new Point(x + dz.getWidth(), y + dz.getHeight() / 2);
+            
+            if (dz != null)
+            {
+                int x = dz.getLocationOnScreen().x - innerFlowPane.getLocationOnScreen().x;
+                int y = dz.getLocationOnScreen().y - innerFlowPane.getLocationOnScreen().y;
+                return new Point(x + dz.getWidth(), y + dz.getHeight() / 2);
+            }
         }
-        
+
         return super.getDragZoneLocation(output);
     }
-    
+
     @Override
     public int getVarPanelWidth()
     {
         return innerLoopPanel.getWidth();
     }
-    
+
     @Override
     public int getVarPanelHeight()
     {
         // return innerLoopPanel.getHeight() + 2;
         return getHeight();
     }
-    
+
     public void drawPanel()
     {
         super.drawPanel();
         if (blockDesc.isCollapsed())
         {
             for (Component c : innerLoopPanel.getComponents())
-                if (c instanceof DragZone<?>) c.setPreferredSize(new Dimension());
-            
+                if (c instanceof DragZone<?>)
+                    c.setPreferredSize(new Dimension());
+
             innerLoopPanel.setSize(innerLoopPanel.getPreferredSize());
             varBox.add(innerLoopPanel);
             Dimension di = varBox.getPreferredSize();
             varBox.setPreferredSize(new Dimension(di.width, di.height + innerLoopPanel.getHeight()));
-            
+
             setSize(getPreferredSize());
         }
-        else for (Component c : innerLoopPanel.getComponents())
-            if (c instanceof DragZone<?>) c.setPreferredSize(new Dimension(DragDropZone.DEFAULT_ICON_SIZE, DragDropZone.DEFAULT_ICON_SIZE));
+        else
+            for (Component c : innerLoopPanel.getComponents())
+                if (c instanceof DragZone<?>)
+                    c.setPreferredSize(new Dimension(DragDropZone.DEFAULT_ICON_SIZE, DragDropZone.DEFAULT_ICON_SIZE));
     }
-    
+
     @Override
     void dispose()
     {
         menuStopOnFirstError.removeActionListener(this);
-        
+
         super.dispose();
     }
 }
diff --git a/src/main/java/plugins/adufour/protocols/gui/block/WorkFlowPanel.java b/src/main/java/plugins/adufour/protocols/gui/block/WorkFlowPanel.java
index 6e893656b7b368216d565344658de4538d3bc084..92bbc08817e60f67efa743f824dd7c7389059d8f 100644
--- a/src/main/java/plugins/adufour/protocols/gui/block/WorkFlowPanel.java
+++ b/src/main/java/plugins/adufour/protocols/gui/block/WorkFlowPanel.java
@@ -165,14 +165,14 @@ public class WorkFlowPanel extends BlockPanel implements VarVisibilityListener
     }
 
     /**
-	 * Draws the drag'n'drop zones representing the exposed variables of the
-	 * inner work flow
-	 * 
-	 * @param row
-	 *            the row where to start drawing within the
-	 *            {@link GridBagLayout}
-	 * @return the last row used in the {@link GridBagLayout}
-	 */
+     * Draws the drag'n'drop zones representing the exposed variables of the
+     * inner work flow
+     * 
+     * @param row
+     *        the row where to start drawing within the
+     *        {@link GridBagLayout}
+     * @return the last row used in the {@link GridBagLayout}
+     */
     protected int drawExposedLinks(final int row)
     {
         int rowIn = row;
@@ -196,8 +196,7 @@ public class WorkFlowPanel extends BlockPanel implements VarVisibilityListener
             gbc_dropZone.gridx = 0;
             gbc_dropZone.gridy = rowIn++;
             gbc_dropZone.weighty = 0;
-            final DragDropZone dropZone = varDropZones.get(input);
-            jPanelContent.add(dropZone, gbc_dropZone);
+            jPanelContent.add(varDropZones.get(input), gbc_dropZone);
         }
 
         int rowOut = row;
@@ -310,7 +309,7 @@ public class WorkFlowPanel extends BlockPanel implements VarVisibilityListener
                 ThreadUtil.invokeLater(new Runnable()
                 {
                     @Override
-					public void run()
+                    public void run()
                     {
                         final BlockPanel ownerPanel = innerFlowPane.getBlockPanel(innerBlock);
 
@@ -361,9 +360,12 @@ public class WorkFlowPanel extends BlockPanel implements VarVisibilityListener
                                 else
                                 {
                                     final DragDropZone dz = ownerPanel.varDropZones.get(variable);
-                                    final Point loc = dz.getLocationOnScreen();
-                                    x2 = loc.x - getLocationOnScreen().x;
-                                    y2 = loc.y - getLocationOnScreen().y + dz.getHeight() / 2;
+                                    if (dz != null)
+                                    {
+                                        final Point loc = dz.getLocationOnScreen();
+                                        x2 = loc.x - getLocationOnScreen().x;
+                                        y2 = loc.y - getLocationOnScreen().y + dz.getHeight() / 2;
+                                    }
                                 }
                             }
                         });
@@ -378,7 +380,7 @@ public class WorkFlowPanel extends BlockPanel implements VarVisibilityListener
                 ThreadUtil.invokeLater(new Runnable()
                 {
                     @Override
-					public void run()
+                    public void run()
                     {
                         final BlockPanel ownerPanel = innerFlowPane.getBlockPanel(innerBlock);
 
@@ -411,9 +413,13 @@ public class WorkFlowPanel extends BlockPanel implements VarVisibilityListener
                                 else
                                 {
                                     final DragDropZone dz = ownerPanel.varDragZones.get(variable);
-                                    final Point loc = dz.getLocationOnScreen();
-                                    x1 = loc.x - getLocationOnScreen().x + dz.getWidth();
-                                    y1 = loc.y - getLocationOnScreen().y + dz.getHeight() / 2;
+                                    
+                                    if (dz != null)
+                                    {
+                                        final Point loc = dz.getLocationOnScreen();
+                                        x1 = loc.x - getLocationOnScreen().x + dz.getWidth();
+                                        y1 = loc.y - getLocationOnScreen().y + dz.getHeight() / 2;
+                                    }
                                 }
                             }
 
@@ -424,11 +430,15 @@ public class WorkFlowPanel extends BlockPanel implements VarVisibilityListener
                                     return;
 
                                 final DragDropZone dz = varDragZones.get(variable);
-                                final int y = dz.getLocationOnScreen().y;
-                                final int innerY = getLocationOnScreen().y;
+                                
+                                if (dz != null)
+                                {
+                                    final int y = dz.getLocationOnScreen().y;
+                                    final int innerY = getLocationOnScreen().y;
 
-                                x2 = dz.getLocation().x;
-                                y2 = y - innerY + dz.getHeight() / 2;
+                                    x2 = dz.getLocation().x;
+                                    y2 = y - innerY + dz.getHeight() / 2;
+                                }
                             }
                         });
                     }
@@ -482,7 +492,7 @@ public class WorkFlowPanel extends BlockPanel implements VarVisibilityListener
     }
 
     @Override
-	public void drawPanel()
+    public void drawPanel()
     {
         super.drawPanel();
         varBox.setVisible(blockDesc.isCollapsed());
@@ -571,10 +581,15 @@ public class WorkFlowPanel extends BlockPanel implements VarVisibilityListener
                     varPanel = new JPanel(new GridBagLayout());
                     varPanel.setOpaque(false);
 
-                    varPanel.add(varDropZones.get(v), gbc_dropZone);
-                    varPanel.add(new JLabel("\t" + v.getName()), gbc_varName);
+                    final DragDropZone dz = varDropZones.get(v);
 
-                    blockBox.add(varPanel);
+                    if (dz != null)
+                    {
+                        varPanel.add(dz, gbc_dropZone);
+                        varPanel.add(new JLabel("\t" + v.getName()), gbc_varName);
+
+                        blockBox.add(varPanel);
+                    }
                 }
 
                 for (final Var<?> v : outputs.get(bd))
@@ -584,9 +599,15 @@ public class WorkFlowPanel extends BlockPanel implements VarVisibilityListener
 
                     varPanel.add(new JLabel("\t\t\t"), gbc_dropZone);
                     varPanel.add(new JLabel("\t" + v.getName()), gbc_varName);
-                    varPanel.add(varDragZones.get(v), gbc_dragZone);
 
-                    blockBox.add(varPanel);
+                    final DragDropZone dz = varDragZones.get(v);
+
+                    if (dz != null)
+                    {
+                        varPanel.add(dz, gbc_dragZone);
+
+                        blockBox.add(varPanel);
+                    }
                 }
 
                 varBox.add(blockP);
@@ -596,7 +617,7 @@ public class WorkFlowPanel extends BlockPanel implements VarVisibilityListener
     }
 
     @Override
-	public Dimension getPreferredSize()
+    public Dimension getPreferredSize()
     {
         final Dimension d = super.getPreferredSize();