diff --git a/src/libs/qmljs/qmljslink.cpp b/src/libs/qmljs/qmljslink.cpp
index 660d4f7ff7dfe27f69d219f0f4ca6a0aa95cbfb6..c94ad265e053120aefa25ba86e8373cf41e8ef62 100644
--- a/src/libs/qmljs/qmljslink.cpp
+++ b/src/libs/qmljs/qmljslink.cpp
@@ -49,6 +49,7 @@ void Link::scopeChainAt(Document::Ptr doc, const QList<Node *> &astPath)
         _context->setLookupMode(Context::QmlLookup);
 
         scopeChain.qmlComponentScope.clear();
+        componentScopes.insert(doc.data(), &scopeChain.qmlComponentScope);
         makeComponentChain(doc, &scopeChain.qmlComponentScope, &componentScopes);
 
         if (const ObjectValue *typeEnvironment = _context->typeEnvironment(doc.data()))
@@ -93,7 +94,7 @@ void Link::makeComponentChain(
             continue;
         if (otherDoc->bind()->usesQmlPrototype(bind->rootObjectValue(), _context)) {
             if (components->contains(otherDoc.data())) {
-                target->instantiatingComponents += components->value(otherDoc.data());
+//                target->instantiatingComponents += components->value(otherDoc.data());
             } else {
                 ScopeChain::QmlComponentChain *component = new ScopeChain::QmlComponentChain;
                 components->insert(otherDoc.data(), component);
diff --git a/src/libs/qmljs/qmljsscopebuilder.cpp b/src/libs/qmljs/qmljsscopebuilder.cpp
index 18c8dcf1b8c73e7434fc7cb3272c9fa852122a97..9ab4381441f4b5ff93848edda3dbb475337db7b9 100644
--- a/src/libs/qmljs/qmljsscopebuilder.cpp
+++ b/src/libs/qmljs/qmljsscopebuilder.cpp
@@ -69,6 +69,8 @@ void ScopeBuilder::setQmlScopeObject(Node *node)
     const ObjectValue *scopeObject = _doc->bind()->findQmlObject(node);
     if (scopeObject) {
         scopeChain.qmlScopeObjects += scopeObject;
+    } else {
+        return; // Probably syntax errors, where we're working with a "recovered" AST.
     }
 
 #ifndef NO_DECLARATIVE_BACKEND