diff --git a/src/node/handler/ImportHandler.js b/src/node/handler/ImportHandler.js
index 6ea76cac3..9109853e6 100644
--- a/src/node/handler/ImportHandler.js
+++ b/src/node/handler/ImportHandler.js
@@ -211,9 +211,15 @@ async function doImport(req, res, padId)
* Moreover, when using LibreOffice to convert the file, some classes are
* added to the
tag. This is a quick & dirty way of matching the
* title and comment it out independently on the classes that are set on it.
+ *
+ * @todo what happens if ","-->");
+ if (text.match(/<\/title>/)){
+ text = text.replace("","-->");
+ } else {
+ text = text.replace(/]*\/>/,'');
+ }
// node on windows has a delay on releasing of the file lock.
// We add a 100ms delay to work around this
diff --git a/src/node/utils/LibreOffice.js b/src/node/utils/LibreOffice.js
index dfbee8fa5..3fc80faf0 100644
--- a/src/node/utils/LibreOffice.js
+++ b/src/node/utils/LibreOffice.js
@@ -85,7 +85,8 @@ function doConvertTask(task, callback) {
'--nologo',
'--nolockcheck',
'--writer',
- '--convert-to', task.type,
+ '--convert-to',
+ `${task.type}:XHTML Writer File:UTF8`,
task.srcFile,
'--outdir', tmpDir
]);
diff --git a/tests/backend/specs/api/docImport.js b/tests/backend/specs/api/docImport.js
index e2948408e..5c8f73be1 100644
--- a/tests/backend/specs/api/docImport.js
+++ b/tests/backend/specs/api/docImport.js
@@ -108,7 +108,7 @@ describe('getText', function(){
setTimeout(function(){
api.get(endPoint('getText')+"&padID="+testPadId)
.expect(function(res){
- if(res.body.data.text.indexOf("RichardC. Hay" !== -1)){
+ if(res.body.data.text.indexOf("RichardC. Hay") !== -1) {
console.warn(res.body.data.text);
throw new Error("Error with doc keeping spaces", res.body.data.text);
}