diff --git a/apps/files_encryption/lib/stream.php b/apps/files_encryption/lib/stream.php
index 3bad43de2e06aac802bafa3607acfaa1de4ac703..d269a5624041d4c9ef7e8f3334c18d09064511a3 100644
--- a/apps/files_encryption/lib/stream.php
+++ b/apps/files_encryption/lib/stream.php
@@ -51,7 +51,7 @@ class Stream {
 
 	// TODO: make all below properties private again once unit testing is 
 	// configured correctly
-	public $rawPath; // The raw path received by stream_open
+	public $rawPath; // The raw path relative to the data dir
 	public $relPath; // rel path to users file dir
 	private $userId;
 	private $handle; // Resource returned by fopen
@@ -77,12 +77,11 @@ class Stream {
 
 		}
 
-		// Strip identifier text from path
-		$this->rawPath = str_replace( 'crypt://', '', $path );
+		// Strip identifier text from path, this gives us the path relative to data/<user>/files
+		$this->relPath = str_replace( 'crypt://', '', $path );
 		
-		// Set file path relative to user files dir (7 = string length of '/files/')
-		$this->relPath = substr($this->rawPath, strlen($this->userId)+7);
-		//$this->relPath = $this->userId . '/files/' . $this->rawPath;
+		// rawPath is relative to the data directory
+		$this->rawPath = $this->userId . '/files/' . $this->relPath;
 		
 		if ( 
 		dirname( $this->rawPath ) == 'streams' 
diff --git a/apps/files_encryption/lib/util.php b/apps/files_encryption/lib/util.php
index 4605c0f597dd8eea8fb70c2607ddb31dbb4c1ef1..6e0aeb96e96120e7e243c54273bbda7c59c6a8d8 100644
--- a/apps/files_encryption/lib/util.php
+++ b/apps/files_encryption/lib/util.php
@@ -344,7 +344,7 @@ class Util {
 						// If the file is not encrypted
 						} else {
 						
-							$found['plain'][] = array( 'name' => $file, 'path' => $filePath );
+							$found['plain'][] = array( 'name' => $file, 'path' => $relPath );
 						
 						}