diff --git a/lib/api.php b/lib/api.php
index 6ee570d60e79ba506e7d32a78b2cc8fa72557c0c..155082fa0d0b2edd228942eecd88a009504233c8 100644
--- a/lib/api.php
+++ b/lib/api.php
@@ -44,7 +44,7 @@ class OC_API {
 		$name = strtolower($method).$url;
 		$name = str_replace(array('/', '{', '}'), '_', $name);
 		if(!isset(self::$actions[$name])){
-			OC::$router->create($name, $url.'.{_format}')
+			OC::getRouter()->create($name, $url.'.{_format}')
 				->method($method)
 				->defaults(array('_format' => 'xml') + $defaults)
 				->requirements(array('_format' => 'xml|json') + $requirements)
diff --git a/lib/base.php b/lib/base.php
index 29a3502e35288c5598c8167f151cfd8f5f85fe4e..43588944d04dde703fd7ac7a90bdcc8c6ab037b0 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -62,14 +62,14 @@ class OC{
 	 * requested file of app
 	 */
 	public static $REQUESTEDFILE = '';
-	/*
-	 * OC router
-	 */
-	public static $router = null;
 	/**
 	 * check if owncloud runs in cli mode
 	 */
 	public static $CLI = false;
+	/*
+	 * OC router
+	 */
+	protected static $router = null;
 	/**
 	 * SPL autoload
 	 */
@@ -275,6 +275,14 @@ class OC{
 		}
 	}
 
+	public static function getRouter() {
+		if (!isset(OC::$router)) {
+			OC::$router = new OC_Router();
+		}
+
+		return OC::$router;
+	}
+
 	public static function init(){
 		// register autoloader
 		spl_autoload_register(array('OC','autoload'));
@@ -358,8 +366,6 @@ class OC{
 		OC_User::useBackend(new OC_User_Database());
 		OC_Group::useBackend(new OC_Group_Database());
 
-		OC::$router = new OC_Router();
-
 		// Load Apps
 		// This includes plugins for users and filesystems as well
 		global $RUNTIME_NOAPPS;
diff --git a/ocs/v1.php b/ocs/v1.php
index 7cd61035e7c94919176e9f0100dbb57ef024121f..cb8a1faf876187ca4033e64a161db532dbfa159f 100644
--- a/ocs/v1.php
+++ b/ocs/v1.php
@@ -25,11 +25,11 @@ require_once('../lib/base.php');
 use Symfony\Component\Routing\Exception\ResourceNotFoundException;
 use Symfony\Component\Routing\Exception\MethodNotAllowedException;
 
-OC::$router->useCollection('ocs');
-OC::$router->loadRoutes();
+OC::getRouter()->useCollection('ocs');
+OC::getRouter()->loadRoutes();
 
 try {
-	OC::$router->match($_SERVER['PATH_INFO']);
+	OC::getRouter()->match($_SERVER['PATH_INFO']);
 } catch (ResourceNotFoundException $e) {
 	OC_OCS::notFound();
 } catch (MethodNotAllowedException $e) {