diff --git a/src/Odf.php b/src/Odf.php
index 3a07ccc..03f00ce 100644
--- a/src/Odf.php
+++ b/src/Odf.php
@@ -307,7 +307,7 @@ private function _save()
$manifdata = $manifdata.''."\n";
}
//Place content of $manifdata variable in manifest.xml file at appropriate place
- $this->manifestXml = substr_replace($this->manifestXml, "\n".$manifdata, $lastpos+1, 0);
+ $replace = ''; $this->manifestXml = str_replace($replace, $replace . "\n" . $manifdata, $this->manifestXml);
//$this->manifestXml = $this->manifestXml ."\n".$manifdata;
if (! $this->file->addFromString('META-INF/manifest.xml', $this->manifestXml)) {