diff --git a/apps/files_encryption/lib/keymanager.php b/apps/files_encryption/lib/keymanager.php
index 9be3dda7ce3f766a8d62054194bbaa419593952f..7143fcff0f63b7719849abc40f2450ed90179494 100755
--- a/apps/files_encryption/lib/keymanager.php
+++ b/apps/files_encryption/lib/keymanager.php
@@ -40,11 +40,14 @@ class Keymanager {
 	public static function getPrivateKey(\OC_FilesystemView $view, $user) {
 
 		$path = '/' . $user . '/' . 'files_encryption' . '/' . $user . '.private.key';
+		$key = false;
 
 		$proxyStatus = \OC_FileProxy::$enabled;
 		\OC_FileProxy::$enabled = false;
 
-		$key = $view->file_get_contents($path);
+		if ($view->file_exists($path)) {
+			$key = $view->file_get_contents($path);
+		}
 
 		\OC_FileProxy::$enabled = $proxyStatus;
 
diff --git a/apps/files_encryption/lib/proxy.php b/apps/files_encryption/lib/proxy.php
index eb7ba60cb9d17821b62cd74a3f1f68b0f387b8cb..4ec810a51996e817cca39324e8a9bbf0ec4fe6c5 100644
--- a/apps/files_encryption/lib/proxy.php
+++ b/apps/files_encryption/lib/proxy.php
@@ -50,9 +50,8 @@ class Proxy extends \OC_FileProxy {
 	private static function shouldEncrypt($path) {
 
 		if (is_null(self::$enableEncryption)) {
-
 			if (
-				\OCP\Config::getAppValue('files_encryption', 'enable_encryption', 'true') === 'true'
+				\OCP\App::isEnabled('files_encryption') === true
 				&& Crypt::mode() === 'server'
 			) {
 
@@ -200,7 +199,7 @@ class Proxy extends \OC_FileProxy {
 	 */
 	public function preUnlink($path) {
 
-		// let the trashbin handle this  
+		// let the trashbin handle this
 		if (\OCP\App::isEnabled('files_trashbin')) {
 			return true;
 		}
@@ -291,7 +290,7 @@ class Proxy extends \OC_FileProxy {
 			// Close the original encrypted file
 			fclose($result);
 
-			// Open the file using the crypto stream wrapper 
+			// Open the file using the crypto stream wrapper
 			// protocol and let it do the decryption work instead
 			$result = fopen('crypt://' . $path, $meta['mode']);