diff --git a/apps/files_encryption/lib/helper.php b/apps/files_encryption/lib/helper.php
index 6eee8fed6a63932b01071dc0b173ee8041dc6f1a..f5a5d269a6997fb9d82d2ab933cb566815eda920 100755
--- a/apps/files_encryption/lib/helper.php
+++ b/apps/files_encryption/lib/helper.php
@@ -199,12 +199,39 @@ class Helper {
 	public static function stripUserFilesPath($path) {
 		$trimmed = ltrim($path, '/');
 		$split = explode('/', $trimmed);
+		
+		// it is not a file relative to data/user/files
+		if ($split[1] !== 'files') {
+			return false;
+		}
+		
 		$sliced = array_slice($split, 2);
 		$relPath = implode('/', $sliced);
 
 		return $relPath;
 	}
 
+	/**
+	 * @brief get path to the correspondig file in data/user/files
+	 * @param string $path path to a version or a file in the trash
+	 * @return string path to correspondig file relative to data/user/files
+	 */
+	public static function getPathToRealFile($path) {
+		$trimmed = ltrim($path, '/');
+		$split = explode('/', $trimmed);
+		
+		if ($split[1] !== "files_versions") {
+			return false;
+		}
+		
+		$sliced = array_slice($split, 2);
+		$realPath = implode('/', $sliced);
+		//remove the last .v
+		$realPath = substr($realPath, 0, strrpos($realPath, '.v'));
+
+		return $realPath;
+	}	
+	
 	/**
 	 * @brief redirect to a error page
 	 */
diff --git a/apps/files_encryption/lib/proxy.php b/apps/files_encryption/lib/proxy.php
index 735eba911a952b4adeaed4daf10b84e74b9cd17c..12fee750a6a8721a151ba831d19df0697fe508e0 100644
--- a/apps/files_encryption/lib/proxy.php
+++ b/apps/files_encryption/lib/proxy.php
@@ -116,7 +116,7 @@ class Proxy extends \OC_FileProxy {
 					return true;
 				}
 
-				$handle = fopen('crypt://' . $relativePath . '.etmp', 'w');
+				$handle = fopen('crypt://' . $path . '.etmp', 'w');
 				if (is_resource($handle)) {
 
 					// write data to stream
@@ -296,14 +296,14 @@ class Proxy extends \OC_FileProxy {
 
 			// Open the file using the crypto stream wrapper 
 			// protocol and let it do the decryption work instead
-			$result = fopen('crypt://' . $relativePath, $meta['mode']);
+			$result = fopen('crypt://' . $path, $meta['mode']);
 
 		} elseif (
 			self::shouldEncrypt($path)
 			and $meta ['mode'] !== 'r'
 				and $meta['mode'] !== 'rb'
 		) {
-			$result = fopen('crypt://' . $relativePath, $meta['mode']);
+			$result = fopen('crypt://' . $path, $meta['mode']);
 		}
 
 		// Re-enable the proxy
diff --git a/apps/files_encryption/lib/stream.php b/apps/files_encryption/lib/stream.php
index 3c1eb2c5f5e5dcb4273c40040107d07a590fb18b..2f7af1410b9899998641b934740a7ab78a3bb202 100644
--- a/apps/files_encryption/lib/stream.php
+++ b/apps/files_encryption/lib/stream.php
@@ -73,7 +73,7 @@ class Stream {
 	private $privateKey;
 
 	/**
-	 * @param $path
+	 * @param $path raw path relative to data/
 	 * @param $mode
 	 * @param $options
 	 * @param $opened_path
@@ -93,12 +93,16 @@ class Stream {
 
 		$this->userId = $util->getUserId();
 
-		// Strip identifier text from path, this gives us the path relative to data/<user>/files
-		$this->relPath = \OC\Files\Filesystem::normalizePath(str_replace('crypt://', '', $path));
-
 		// rawPath is relative to the data directory
-		$this->rawPath = $util->getUserFilesDir() . $this->relPath;
+		$this->rawPath = \OC\Files\Filesystem::normalizePath(str_replace('crypt://', '', $path));
 
+		// Strip identifier text from path, this gives us the path relative to data/<user>/files
+		$this->relPath = Helper::stripUserFilesPath($this->rawPath);
+		// if raw path doesn't point to a real file, check if it is a version or a file in the trash bin
+		if ($this->relPath === false) {
+			$this->relPath = Helper::getPathToRealFile($this->rawPath);
+		}
+		
 		// Disable fileproxies so we can get the file size and open the source file without recursive encryption
 		$proxyStatus = \OC_FileProxy::$enabled;
 		\OC_FileProxy::$enabled = false;
diff --git a/apps/files_trashbin/lib/trash.php b/apps/files_trashbin/lib/trash.php
index b9d900dfab42b9b945c06fb0692fb2b54d7e4e3d..cdf8d950e6082d5ec4aa10981ca7c4dc0e6ed92a 100644
--- a/apps/files_trashbin/lib/trash.php
+++ b/apps/files_trashbin/lib/trash.php
@@ -693,7 +693,7 @@ class Trashbin {
 				\OC_Log::write('files_trashbin', 'remove "' . $filename . '" fom trash bin because it is older than ' . $retention_obligation, \OC_log::INFO);
 			}
 		}
-		$availableSpace = $availableSpace + $size;
+		$availableSpace += $size;
 		// if size limit for trash bin reached, delete oldest files in trash bin
 		if ($availableSpace < 0) {
 			$query = \OC_DB::prepare('SELECT `location`,`type`,`id`,`timestamp` FROM `*PREFIX*files_trash`'
diff --git a/settings/personal.php b/settings/personal.php
index 1e2e1cf6723a8543fe5b8c5ee69488ef7b25c6ec..4961661e25019659a85332d6377acdbaf50227ac 100644
--- a/settings/personal.php
+++ b/settings/personal.php
@@ -24,6 +24,15 @@ $email=OC_Preferences::getValue(OC_User::getUser(), 'settings', 'email', '');
 $userLang=OC_Preferences::getValue( OC_User::getUser(), 'core', 'lang', OC_L10N::findLanguage() );
 $languageCodes=OC_L10N::findAvailableLanguages();
 
+//check if encryption was enabled in the past
+$enableDecryptAll = false;
+if (OC_App::isEnabled('files_encryption') === false) {
+	$view = new OC\Files\View('/'.OC_User::getUser());
+	if ($view->file_exists('files_encryption/keyfiles')) {
+		$enableDecryptAll = true;
+	}
+}
+
 // array of common languages
 $commonlangcodes = array(
 	'en', 'es', 'fr', 'de', 'de_DE', 'ja_JP', 'ar', 'ru', 'nl', 'it', 'pt_BR', 'pt_PT', 'da', 'fi_FI', 'nb_NO', 'sv', 'zh_CN', 'ko'
@@ -80,6 +89,7 @@ $tmpl->assign('activelanguage', $userLang);
 $tmpl->assign('passwordChangeSupported', OC_User::canUserChangePassword(OC_User::getUser()));
 $tmpl->assign('displayNameChangeSupported', OC_User::canUserChangeDisplayName(OC_User::getUser()));
 $tmpl->assign('displayName', OC_User::getDisplayName());
+$tmpl->assign('enableDecryptAll' , true);
 
 $forms=OC_App::getForms('personal');
 $tmpl->assign('forms', array());
diff --git a/settings/templates/personal.php b/settings/templates/personal.php
index b9d9b09f5d0149b7416a1eef743991a1a9cf346f..c0f3600a51e0a0f16361bc6c850328808f40d1b5 100644
--- a/settings/templates/personal.php
+++ b/settings/templates/personal.php
@@ -110,6 +110,24 @@ if($_['passwordChangeSupported']) {
 	print_unescaped($form);
 };?>
 
+<?php if($_['enableDecryptAll']): ?>
+<form id="encryption">
+	<fieldset class="personalblock">
+		<legend>
+			<?php p( $l->t( 'Encryption' ) ); ?>
+		</legend>
+		<?php p($l->t( "The encryption app is no longer enabled, decrypt all your file" )); ?>
+		<p>
+			<button
+				type="button"
+				name="submitDecryptAll"><?php p($l->t( "Decrypt all Files" )); ?>
+			</button>
+		</p>
+		<br />
+	</fieldset>
+</form>
+<?php endif; ?>
+
 <fieldset class="personalblock">
 	<legend><strong><?php p($l->t('Version'));?></strong></legend>
 	<strong><?php p($theme->getName()); ?></strong> <?php p(OC_Util::getVersionString()); ?><br/>