diff --git a/product/CMFActivity/Activity/SQLDict.py b/product/CMFActivity/Activity/SQLDict.py
index d95f127868bb8d8c108f91a420ceb90bbbb1e53e..418437f051e94f3784680fae757369053efee120 100755
--- a/product/CMFActivity/Activity/SQLDict.py
+++ b/product/CMFActivity/Activity/SQLDict.py
@@ -47,11 +47,13 @@ class SQLDict(RAMDict):
 
   def dequeueMessage(self, activity_tool, processing_node):
     result = activity_tool.SQLDict_readMessage(processing_node=processing_node)
-    get_transaction().commit() # Release locks before starting a potentially long calculation
     if len(result) > 0:
       line = result[0]
       path = line.path
       method_id = line.method_id
+      # Make sure message can not be processed anylonger
+      activity_tool.SQLDict_assignMessage(path=path, method_id=method_id, processing_node = INVOKE_ERROR_STATE)
+      get_transaction().commit() # Release locks before starting a potentially long calculation
       m = self.loadMessage(line.message)
       if m.validate(self, activity_tool):
         activity_tool.invoke(m)                                           # Try to invoke the message
@@ -60,7 +62,7 @@ class SQLDict(RAMDict):
           get_transaction().commit()                                        # If successful, commit
         else:
           get_transaction().abort()                                         # If not, abort transaction and start a new one
-          activity_tool.SQLDict_assignMessage(path=path, method_id=method_id, processing_node = INVOKE_ERROR_STATE)
+          #activity_tool.SQLDict_assignMessage(path=path, method_id=method_id, processing_node = INVOKE_ERROR_STATE)
                                                                             # Assign message back to 'error' state
           get_transaction().commit()                                        # and commit
       else:
@@ -68,6 +70,7 @@ class SQLDict(RAMDict):
                                                                           # Assign message back to 'error' state
         get_transaction().commit()                                        # and commit
       return 0
+    get_transaction().commit() # Release locks before starting a potentially long calculation
     return 1
 
   def hasActivity(self, activity_tool, object, method_id=None, **kw):