diff --git a/autoreadmore.php b/autoreadmore.php
index 5e65c97..a800008 100644
--- a/autoreadmore.php
+++ b/autoreadmore.php
@@ -51,7 +51,7 @@ public function __construct(&$subject, $config)
 
 		$j = new Version();
 		$version=substr($j->getShortVersion(), 0,1); 
-		if ($version != "4") { // Joomla 4.0
+		if ($version < "4") { // Joomla 4.0
 			JLoader::registerNamespace('ConseilGouz\Plugin\Content\Autoreadmore', JPATH_SITE . '/plugins/content/autoreadmore/src', false, false, 'psr4');
 	}
 	}
diff --git a/autoreadmore.xml b/autoreadmore.xml
index c571531..fcfaa80 100644
--- a/autoreadmore.xml
+++ b/autoreadmore.xml
@@ -1,13 +1,13 @@
 <?xml version="1.0" encoding="utf-8"?>
 <extension version="3.10" type="plugin" group="content" method="upgrade">
 	<name>PLG_CONTENT_AUTOREADMORE_TITLE</name>
-	<creationDate>2023-03-07</creationDate>
+	<creationDate>2023-09-12</creationDate>
 	<copyright>Copyright (C) 2023 Conseilgouz All rights reserved.</copyright>
 	<license>http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL</license>
 	<author>ConseilGouz</author>
 	<authorEmail>pascal.leconte@conseilgouz.com</authorEmail>
 	<authorUrl>https://www.conseilgouz.com</authorUrl>
-	<version>5.1.0</version>
+	<version>5.1.1</version>
 	<description>PLG_CONTENT_AUTOREADMORE_THANK_YOU_FOR_USING_AUTO_READ_MORE</description>
 	<namespace path="src">ConseilGouz\Plugin\Content\Autoreadmore</namespace>	
 	<files>
diff --git a/plg_autoreadmore_changelog.xml b/plg_autoreadmore_changelog.xml
index 8ff4352..b549478 100644
--- a/plg_autoreadmore_changelog.xml
+++ b/plg_autoreadmore_changelog.xml
@@ -1,4 +1,15 @@
 <changelogs>
+	<changelog>
+		<element>autoreadmore</element>
+		<type>plugin</type>
+		<version>5.1.1</version>
+        <note>
+            <item>12/09/2023</item>
+        </note>
+         <fix>
+            <item>Joomla 5.x compatibility</item>
+        </fix>
+	</changelog>
 	<changelog>
 		<element>autoreadmore</element>
 		<type>plugin</type>
diff --git a/scriptfile.php b/scriptfile.php
index b97ae50..81c4bea 100644
--- a/scriptfile.php
+++ b/scriptfile.php
@@ -3,15 +3,17 @@
 defined('_JEXEC') or die;
 use Joomla\CMS\Factory;
 use Joomla\CMS\Language\Text;
-use Joomla\CMS\Filesystem\Folder;
+use Joomla\Filesystem\Folder;
 use Joomla\CMS\Version;
-use Joomla\CMS\Filesystem\File;
+use Joomla\Filesystem\File;
 
 class plgContentAutoreadmoreInstallerScript  {
 	
 	private $extname                 = 'autoreadmore';	
 	private $min_joomla_version      = '3.10.0';
 	private $min_php_version         = '7.2';
+	private $dir;
+	private $lang;
 	
 	public function __construct()
 	{