diff --git a/src/plugins/adufour/protocols/gui/block/BlockPanel.java b/src/plugins/adufour/protocols/gui/block/BlockPanel.java
index 52e5180d10e1114cf9618f7ea60492d017720a48..07e6f832be1bd0d24257d8940c456b8dcebc11e6 100644
--- a/src/plugins/adufour/protocols/gui/block/BlockPanel.java
+++ b/src/plugins/adufour/protocols/gui/block/BlockPanel.java
@@ -90,13 +90,18 @@ public class BlockPanel extends JPanel implements ActionListener, BlockListener
             if (dragging)
             {
                 WorkFlow wf = workFlowPane.getWorkFlow();
+                
                 if (wf.isBlockSelected(blockDesc))
+                {
                     for (BlockDescriptor bd : wf.getBlockSelection())
                     {
                         BlockPanel bp = workFlowPane.getBlockPanel(bd);
-                        bp.setBounds(Math.max(0, dx - pressedX + bp.getX()), Math.max(0, dy - pressedY + bp.getY()),
-                                bp.getWidth(), bp.getHeight());
+
+                        if (bp != null)
+                            bp.setBounds(Math.max(0, dx - pressedX + bp.getX()), Math.max(0, dy - pressedY + bp.getY()),
+                                    bp.getWidth(), bp.getHeight());
                     }
+                }
                 else
                     setBounds(Math.max(0, dx - pressedX + x), Math.max(0, dy - pressedY + y), w, h);
             }
diff --git a/src/plugins/adufour/protocols/gui/block/WorkFlowContainer.java b/src/plugins/adufour/protocols/gui/block/WorkFlowContainer.java
index c954e10cb37851b3d6c93d5a6bf04e7ab03ad276..f07994a50be0a182be04cf009a2783e42722738d 100644
--- a/src/plugins/adufour/protocols/gui/block/WorkFlowContainer.java
+++ b/src/plugins/adufour/protocols/gui/block/WorkFlowContainer.java
@@ -315,21 +315,29 @@ public class WorkFlowContainer extends JLayeredPane implements WorkFlowListener,
                 BlockPanel srcBlockPanel = getBlockPanel(link.srcBlock);
                 BlockPanel dstBlockPanel = getBlockPanel(link.dstBlock);
 
-                linkLines.put(link, new RoundedSquareLine(srcBlockPanel, dstBlockPanel, link));
-
-                // refresh the target block
-                if (dstBlockPanel instanceof WorkFlowPanel)
+                if ((srcBlockPanel == null) || (dstBlockPanel == null))
                 {
-                    WorkFlowContainer innerFlow = ((WorkFlowPanel) dstBlockPanel).innerFlowPane;
-
-                    BlockDescriptor targetInnerlBlock = innerFlow.workFlow.getInputOwner(link.dstVar);
-
-                    innerFlow.getBlockPanel(targetInnerlBlock).refreshNow();
+                    System.err.println("Warning: cannot recover link between " + link.srcBlock.getDefinedName()
+                            + " and " + link.dstBlock.getDefinedName() + " !");
                 }
                 else
-                    dstBlockPanel.refreshNow();
+                {
+                    linkLines.put(link, new RoundedSquareLine(srcBlockPanel, dstBlockPanel, link));
 
-                repaint();
+                    // refresh the target block
+                    if (dstBlockPanel instanceof WorkFlowPanel)
+                    {
+                        WorkFlowContainer innerFlow = ((WorkFlowPanel) dstBlockPanel).innerFlowPane;
+
+                        BlockDescriptor targetInnerlBlock = innerFlow.workFlow.getInputOwner(link.dstVar);
+
+                        innerFlow.getBlockPanel(targetInnerlBlock).refreshNow();
+                    }
+                    else
+                        dstBlockPanel.refreshNow();
+                    
+                    repaint();
+                }
             }
         }, true);
     }
@@ -638,15 +646,12 @@ public class WorkFlowContainer extends JLayeredPane implements WorkFlowListener,
         Line line = linkLines.remove(link);
 
         if (line == null)
-        {
             System.err.println("Warning: missing link, cannot be removed properly");
-        }
         else
-        {
             line.dispose();
-        }
 
         BlockPanel dstBlockPanel = getBlockPanel(link.dstBlock);
+
         if (dstBlockPanel != null)
         {
             // refresh the target block
diff --git a/src/plugins/adufour/protocols/gui/block/WorkFlowPanel.java b/src/plugins/adufour/protocols/gui/block/WorkFlowPanel.java
index 27bc16d6ec0315444f77a0b47f75eb4f5c74b3a2..b1114dc50a7aed7c0ec1c43805d253ffc107f0c4 100644
--- a/src/plugins/adufour/protocols/gui/block/WorkFlowPanel.java
+++ b/src/plugins/adufour/protocols/gui/block/WorkFlowPanel.java
@@ -297,6 +297,7 @@ public class WorkFlowPanel extends BlockPanel implements VarVisibilityListener
                     public void run()
                     {
                         final BlockPanel ownerPanel = innerFlowPane.getBlockPanel(innerBlock);
+                        
                         exposingLinks.put(variable, new RoundedSquareLine(WorkFlowPanel.this, ownerPanel, variable)
                         {
                             @Override
@@ -360,6 +361,7 @@ public class WorkFlowPanel extends BlockPanel implements VarVisibilityListener
                     {
                         
                         final BlockPanel ownerPanel = innerFlowPane.getBlockPanel(innerBlock);
+                        
                         exposingLinks.put(variable, new RoundedSquareLine(ownerPanel, WorkFlowPanel.this, variable)
                         {
                             @Override