diff --git a/lib/private/installer.php b/lib/private/installer.php
index bbb8bc5a1527b43828f29eb6b343e68c41246c85..06677115c8e6384d3b1224ef6c27f27678569891 100644
--- a/lib/private/installer.php
+++ b/lib/private/installer.php
@@ -164,21 +164,7 @@ class OC_Installer{
 	 * upgrade.php can determine the current installed version of the app using
 	 * "OC_Appconfig::getValue($appid, 'installed_version')"
 	 */
-	public static function updateApp( $app ) {
-		$appdata = OC_OCSClient::getApplication($app);
-		$download = OC_OCSClient::getApplicationDownload($app, 1);
-
-		if (isset($download['downloadlink']) && trim($download['downloadlink']) !== '') {
-			$download['downloadlink'] = str_replace(' ', '%20', $download['downloadlink']);
-			$info = array(
-				'source' => 'http',
-				'href' => $download['downloadlink'],
-				'appdata' => $appdata
-			);
-		} else {
-			throw new \Exception('Could not fetch app info!');
-		}
-
+	public static function updateApp( $info=array() ) {
 		list($extractDir, $path) = self::downloadApp($info);
 		$info = self::checkAppsIntegrity($info, $extractDir, $path);
 
@@ -206,6 +192,29 @@ class OC_Installer{
 		return OC_App::updateApp($info['id']);
 	}
 
+	/**
+	 * update an app by it's id
+	 * @param integer $ocsid
+	 * @return bool
+	 * @throws Exception
+	 */
+	public static function updateAppByOCSId($ocsid) {
+		$appdata = OC_OCSClient::getApplication($ocsid);
+		$download = OC_OCSClient::getApplicationDownload($ocsid, 1);
+
+		if (isset($download['downloadlink']) && trim($download['downloadlink']) !== '') {
+			$download['downloadlink'] = str_replace(' ', '%20', $download['downloadlink']);
+			$info = array(
+				'source' => 'http',
+				'href' => $download['downloadlink'],
+				'appdata' => $appdata
+			);
+		} else {
+			throw new \Exception('Could not fetch app info!');
+		}
+
+		return self::updateApp($info);
+	}
 
 	/**
 	 * @param array $data
@@ -322,7 +331,7 @@ class OC_Installer{
 			$version = trim($info['version']);
 		}
 
-		if($version<>trim($data['appdata']['version'])) {
+		if(isset($data['appdata']['version']) && $version<>trim($data['appdata']['version'])) {
 			OC_Helper::rmdirr($extractDir);
 			throw new \Exception($l->t("App can't be installed because the version in info.xml/version is not the same as the version reported from the app store"));
 		}
diff --git a/settings/ajax/updateapp.php b/settings/ajax/updateapp.php
index 5eb0a277cba09dbec3edfd067f52c3bff49ee069..7010dfe23b53a0e510f9ecc569ee5a86e4f65ba7 100644
--- a/settings/ajax/updateapp.php
+++ b/settings/ajax/updateapp.php
@@ -30,7 +30,7 @@ if (!is_numeric($appId)) {
 
 $appId = OC_App::cleanAppId($appId);
 
-$result = OC_Installer::updateApp($appId);
+$result = OC_Installer::updateAppByOCSId($appId);
 if($result !== false) {
 	OC_JSON::success(array('data' => array('appid' => $appId)));
 } else {
diff --git a/tests/data/testapp.zip b/tests/data/testapp.zip
new file mode 100644
index 0000000000000000000000000000000000000000..e76c0d187248193e90ad487fbd172af065695aa3
Binary files /dev/null and b/tests/data/testapp.zip differ
diff --git a/tests/data/testapp2.zip b/tests/data/testapp2.zip
new file mode 100644
index 0000000000000000000000000000000000000000..f46832f7a757b2199f293ab05d16c368f55b3e8e
Binary files /dev/null and b/tests/data/testapp2.zip differ
diff --git a/tests/lib/installer.php b/tests/lib/installer.php
new file mode 100644
index 0000000000000000000000000000000000000000..97b14ef579a050acd5055ef6e49aed2ae6ec558d
--- /dev/null
+++ b/tests/lib/installer.php
@@ -0,0 +1,74 @@
+<?php
+/**
+ * Copyright (c) 2014 Georg Ehrke <georg@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+class Test_Installer extends PHPUnit_Framework_TestCase {
+
+	private static $appid = 'testapp';
+
+	public function testInstallApp() {
+		$pathOfTestApp  = __DIR__;
+		$pathOfTestApp .= '/../data/';
+		$pathOfTestApp .= 'testapp.zip';
+
+		$tmp = OC_Helper::tmpFile();
+		OC_Helper::copyr($pathOfTestApp, $tmp);
+
+		$data = array(
+			'path' => $tmp,
+			'source' => 'path',
+		);
+
+		OC_Installer::installApp($data);
+		$isInstalled = OC_Installer::isInstalled(self::$appid);
+
+		$this->assertTrue($isInstalled);
+
+		//clean-up
+		OC_Installer::removeApp(self::$appid);
+		unlink($tmp);
+	}
+
+	public function testUpdateApp() {
+		$pathOfOldTestApp  = __DIR__;
+		$pathOfOldTestApp .= '/../data/';
+		$pathOfOldTestApp .= 'testapp.zip';
+
+		$oldTmp = OC_Helper::tmpFile();
+		OC_Helper::copyr($pathOfOldTestApp, $oldTmp);
+
+		$oldData = array(
+			'path' => $oldTmp,
+			'source' => 'path',
+		);
+
+		$pathOfNewTestApp  = __DIR__;
+		$pathOfNewTestApp .= '/../data/';
+		$pathOfNewTestApp .= 'testapp2.zip';
+
+		$newTmp = OC_Helper::tmpFile();
+		OC_Helper::copyr($pathOfNewTestApp, $newTmp);
+
+		$newData = array(
+			'path' => $newTmp,
+			'source' => 'path',
+		);
+
+		OC_Installer::installApp($oldData);
+		$oldVersionNumber = OC_App::getAppVersion(self::$appid);
+
+		OC_Installer::updateApp($newData);
+		$newVersionNumber = OC_App::getAppVersion(self::$appid);
+
+		$this->assertNotEquals($oldVersionNumber, $newVersionNumber);
+
+		//clean-up
+		OC_Installer::removeApp(self::$appid);
+		unlink($oldTmp);
+		unlink($newTmp);
+	}
+}