diff --git a/lib/private/legacy/app.php b/lib/private/legacy/app.php
index b20fd8543c8c6b4a709c41bccb7b33df563e73a4..16890fe7435f8d4c1da7be0222e6ea302fb8211f 100644
--- a/lib/private/legacy/app.php
+++ b/lib/private/legacy/app.php
@@ -900,10 +900,11 @@ class OC_App {
 		if($appPath === false) {
 			return false;
 		}
-		self::registerAutoloading($appId, $appPath);
 
 		\OC::$server->getAppManager()->clearAppsCache();
 		$appData = self::getAppInfo($appId);
+
+		self::registerAutoloading($appId, $appPath);
 		self::executeRepairSteps($appId, $appData['repair-steps']['pre-migration']);
 
 		if (file_exists($appPath . '/appinfo/database.xml')) {