diff --git a/product/ERP5OOo/tests/testDms.py b/product/ERP5OOo/tests/testDms.py
index 6e7f0e33ea2d4fc9f38220eb3f3e915d0cbc8037..5227d39b657507f480434d9ade9efab83920e9af 100644
--- a/product/ERP5OOo/tests/testDms.py
+++ b/product/ERP5OOo/tests/testDms.py
@@ -122,8 +122,7 @@ class TestDocument(ERP5TypeTestCase, ZopeTestCase.Functional):
     default_pref.setPreferredDocumentReferenceRegularExpression(REFERENCE_REGULAR_EXPRESSION)
     if default_pref.getPreferenceState() != 'global':
       default_pref.enable()
-    transaction.commit()
-    self.tic()
+    return default_pref
 
   def getDocumentModule(self):
     return getattr(self.getPortal(),'document_module')
diff --git a/product/ERP5OOo/tests/testDmsWithFlare.py b/product/ERP5OOo/tests/testDmsWithFlare.py
index 45de9db2e85b2e210b0d030947b507e816d86781..cb89d96f07b2f6761cb00ae9b3ce9b6e318d1a86 100644
--- a/product/ERP5OOo/tests/testDmsWithFlare.py
+++ b/product/ERP5OOo/tests/testDmsWithFlare.py
@@ -40,9 +40,8 @@ class TestDocumentWithFlare(TestDocument):
     return "DMS with Flare"
 
   def setSystemPreference(self):
-    default_pref = self.portal.portal_preferences.default_site_preference
-    default_pref.setPreferredConversionCacheFactory('dms_cache_factory')
-    TestDocument.setSystemPreference(self)
+    system_preference = TestDocument.setSystemPreference(self)
+    system_preference.setPreferredConversionCacheFactory('dms_cache_factory')
 
 def test_suite():
   suite = unittest.TestSuite()