diff --git a/src/plugins/qmldesigner/core/model/rewriterview.cpp b/src/plugins/qmldesigner/core/model/rewriterview.cpp
index fc4f608af588df6cdeec3f6d04dc10eea5bca958..94c1244daf16c84b7d9b7ad39d4120aa6d4e2dcc 100644
--- a/src/plugins/qmldesigner/core/model/rewriterview.cpp
+++ b/src/plugins/qmldesigner/core/model/rewriterview.cpp
@@ -538,7 +538,7 @@ void RewriterView::qmlTextChanged()
             default: {
                 emitCustomNotification(StartRewriterAmend);
                 ModelAmender differenceHandler(m_textToModelMerger.data());
-                if (m_textToModelMerger->load(newQmlText.toUtf8(), differenceHandler)) {
+                if (m_textToModelMerger->load(newQmlText, differenceHandler)) {
                     lastCorrectQmlSource = newQmlText;
                 }
                 emitCustomNotification(EndRewriterAmend);
diff --git a/src/plugins/qmldesigner/core/model/texttomodelmerger.cpp b/src/plugins/qmldesigner/core/model/texttomodelmerger.cpp
index dd264fbfd75f4aee006a840c7de0987eedb4e413..2d214e82512004e6cab138d321fe6ab32de38147 100644
--- a/src/plugins/qmldesigner/core/model/texttomodelmerger.cpp
+++ b/src/plugins/qmldesigner/core/model/texttomodelmerger.cpp
@@ -255,8 +255,10 @@ void TextToModelMerger::setupImports(const Document::Ptr &doc,
         differenceHandler.importAbsentInQMl(import);
 }
 
-bool TextToModelMerger::load(const QByteArray &data, DifferenceHandler &differenceHandler)
+bool TextToModelMerger::load(const QString &data, DifferenceHandler &differenceHandler)
 {
+//    qDebug() << "TextToModelMerger::load with data:" << data;
+
     const QUrl url = m_rewriterView->model()->fileUrl();
     const QStringList importPaths = m_rewriterView->textModifier()->importPaths();
     setActive(true);
@@ -266,7 +268,7 @@ bool TextToModelMerger::load(const QByteArray &data, DifferenceHandler &differen
         foreach (const QString &importPath, importPaths)
             engine.addImportPath(importPath);
         QDeclarativeComponent comp(&engine);
-        comp.setData(data, url);
+        comp.setData(data.toUtf8(), url);
         if (comp.status() == QDeclarativeComponent::Error) {
             QList<RewriterView::Error> errors;
             foreach (const QDeclarativeError &error, comp.errors())
@@ -288,7 +290,7 @@ bool TextToModelMerger::load(const QByteArray &data, DifferenceHandler &differen
         Snapshot snapshot = m_rewriterView->textModifier()->getSnapshot();
         const QString fileName = url.toLocalFile();
         Document::Ptr doc = Document::create(fileName.isEmpty() ? QLatin1String("<internal>") : fileName);
-        doc->setSource(QString::fromUtf8(data.constData()));
+        doc->setSource(data);
         doc->parseQml();
         snapshot.insert(doc);
         ReadingContext ctxt(snapshot, doc, importPaths);
@@ -671,7 +673,14 @@ QVariant TextToModelMerger::convertToVariant(const ModelNode &node,
         const PropertyMetaInfo propertyMetaInfo = nodeMetaInfo.property(astName, true);
 
         if (propertyMetaInfo.isValid()) {
-            return Internal::PropertyParser::read(propertyMetaInfo.variantTypeId(), cleanedValue);
+            QVariant::Type type = propertyMetaInfo.variantTypeId();
+            if (type == QVariant::Invalid) {
+                const QString propType = propertyMetaInfo.type();
+//                qDebug() << "converting" << cleanedValue << "to" << propType;
+                return Internal::PropertyParser::read(propType, cleanedValue, node.metaInfo().metaInfo());
+            } else {
+                return Internal::PropertyParser::read(type, cleanedValue);
+            }
         } else if (node.type() == QLatin1String("Qt/PropertyChanges")) {
             // In the future, we should do the type resolving in a second pass, or delay setting properties until the full file has been parsed.
             return QVariant(cleanedValue);
@@ -827,6 +836,10 @@ void ModelAmender::shouldBeNodeListProperty(AbstractProperty &modelProperty,
 
 void ModelAmender::variantValuesDiffer(VariantProperty &modelProperty, const QVariant &qmlVariantValue, const QString &dynamicType)
 {
+//    qDebug()<< "ModelAmender::variantValuesDiffer for property"<<modelProperty.name()
+//            << "in node" << modelProperty.parentModelNode().id()
+//            << ", old value:" << modelProperty.value()
+//            << "new value:" << qmlVariantValue;
     if (dynamicType.isEmpty())
         modelProperty.setValue(qmlVariantValue);
     else
diff --git a/src/plugins/qmldesigner/core/model/texttomodelmerger.h b/src/plugins/qmldesigner/core/model/texttomodelmerger.h
index 19a6e4738db4a59feb775f18a41badccfcee80c8..f57dead67fbdaa7f833d4793ec97793de513b87a 100644
--- a/src/plugins/qmldesigner/core/model/texttomodelmerger.h
+++ b/src/plugins/qmldesigner/core/model/texttomodelmerger.h
@@ -55,7 +55,7 @@ public:
     bool isActive() const;
 
     void setupImports(const QmlJS::Document::Ptr &doc, DifferenceHandler &differenceHandler);
-    bool load(const QByteArray &data, DifferenceHandler &differenceHandler);
+    bool load(const QString &data, DifferenceHandler &differenceHandler);
 
     RewriterView *view() const
     { return m_rewriterView; }