diff --git a/scr/src/main/java/org/apache/felix/scr/impl/manager/DependencyManager.java b/scr/src/main/java/org/apache/felix/scr/impl/manager/DependencyManager.java
index ed5c445..d552f68 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/manager/DependencyManager.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/manager/DependencyManager.java
@@ -1215,38 +1215,31 @@
     boolean invokeBindMethod( S componentInstance, ServiceReference<T> ref )
     {
         //event driven, and we already checked this ref is not yet handled.
-        if ( componentInstance != null )
+        Map<DependencyManager<S, ?>, Map<ServiceReference<?>, RefPair<?>>> dependencyMap = m_componentManager.getDependencyMap();
+        if ( dependencyMap != null )
         {
-            Map<DependencyManager<S, ?>, Map<ServiceReference<?>, RefPair<?>>> dependencyMap = m_componentManager.getDependencyMap();
-            if ( dependencyMap != null )
+            if ( m_bindMethods == null )
             {
-                if (m_bindMethods == null)
-                {
-                    m_componentManager.log( LogService.LOG_ERROR,
+                m_componentManager.log( LogService.LOG_ERROR,
                         "For dependency {0}, bind method not set: component state {1}",
                         new Object[]
-                            { m_dependencyMetadata.getName(), new Integer(m_componentManager.getState())  }, null );
+                                {m_dependencyMetadata.getName(), new Integer( m_componentManager.getState() )}, null );
 
-                }
-                Map<ServiceReference<T>, RefPair<T>> deps = (Map)dependencyMap.get( this );
-                RefPair<T> refPair = new RefPair<T>( ref );
-                if ( !m_bindMethods.getBind().getServiceObject( refPair, m_componentManager.getActivator().getBundleContext() ) )
-                {
-                    //reference deactivated while we are processing.
-                    return false;
-                }
-                deps.put( ref, refPair );
-                return invokeBindMethod( componentInstance, refPair );
             }
-            return false;
+            Map<ServiceReference<T>, RefPair<T>> deps = (Map)dependencyMap.get( this );
+            RefPair<T> refPair = new RefPair<T>( ref );
+            if ( !m_bindMethods.getBind().getServiceObject( refPair, m_componentManager.getActivator().getBundleContext() ) )
+            {
+                //reference deactivated while we are processing.
+                return false;
+            }
+            synchronized ( deps )
+            {
+                deps.put( ref, refPair );
+            }
+            return invokeBindMethod( componentInstance, refPair );
         }
-        else
-        {
-            m_componentManager.log( LogService.LOG_DEBUG,
-                "DependencyManager : component not yet created, assuming bind method call succeeded",
-                null );
-            return true;
-        }
+        return false;
     }
 
     public void invokeBindMethodLate( final ServiceReference<T> ref )
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/manager/ImmediateComponentManager.java b/scr/src/main/java/org/apache/felix/scr/impl/manager/ImmediateComponentManager.java
index 222762e..4e6de52 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/manager/ImmediateComponentManager.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/manager/ImmediateComponentManager.java
@@ -259,7 +259,10 @@
             return null;
         }
 
-        // 3. Bind the target services
+        // 3. set the implementation object prematurely
+        setter.presetImplementationObject( implementationObject );
+
+        // 4. Bind the target services
         Map<DependencyManager<S, ?>, Map<ServiceReference<?>, RefPair<?>>> parameters = getDependencyMap();
 
         for ( DependencyManager<S, ?> dm: getDependencyManagers())
@@ -268,7 +271,12 @@
             // creating the instance fails here, so we deactivate and return
             // null.
             Map<ServiceReference<?>, RefPair<?>> params = parameters.get( dm );
-            if ( !dm.open( implementationObject, params ) )
+            boolean open;
+            synchronized ( params )
+            {
+                open = dm.open( implementationObject, params );
+            }
+            if ( !open )
             {
                 log( LogService.LOG_ERROR, "Cannot create component instance due to failure to bind reference {0}",
                         new Object[]
@@ -284,9 +292,6 @@
             }
         }
 
-        // 4. set the implementation object prematurely
-        setter.presetImplementationObject( implementationObject );
-
         // 5. Call the activate method, if present
         final MethodResult result = getComponentMethods().getActivateMethod().invoke( implementationObject, new ActivatorParameter(
                 componentContext, 1 ), null );
