diff --git a/apps/files_encryption/lib/proxy.php b/apps/files_encryption/lib/proxy.php
index e058a528ad0dbb80d9eb6b34d3bd364bcc476501..0d20ff1af1a33468dfa37c734b1f5089db373406 100644
--- a/apps/files_encryption/lib/proxy.php
+++ b/apps/files_encryption/lib/proxy.php
@@ -118,9 +118,6 @@ class Proxy extends \OC_FileProxy {
 					
 					// Decrypt the keyfile
 					$plainKey = Crypt::multiKeyDecrypt( $encKeyfile, $shareKey, $privateKey );
-					
-// 					trigger_error("\$shareKey = $shareKey");
-// 					trigger_error("\$plainKey = $plainKey");
 				
 				} else {
 				
@@ -207,8 +204,6 @@ class Proxy extends \OC_FileProxy {
 			$plainKeyfile = Crypt::multiKeyDecrypt( $encKeyfile, $shareKey, $privateKey );
 		
 			$plainData = Crypt::symmetricDecryptFileContent( $data, $plainKeyfile );
-			
-// 			trigger_error("PLAINDATA = ". var_export($plainData, 1));
 
 		} elseif (
 		Crypt::mode() == 'server' 
diff --git a/apps/files_encryption/lib/stream.php b/apps/files_encryption/lib/stream.php
index 6fb95934c32be68e337386fbee3cfff4990001c3..9a37c3b08ee137c64ac9c4d0f0125d0f0d296c3a 100644
--- a/apps/files_encryption/lib/stream.php
+++ b/apps/files_encryption/lib/stream.php
@@ -86,6 +86,9 @@ class Stream {
 		// rawPath is relative to the data directory
 		$this->rawPath = $this->userId . '/files/' . $this->relPath;
 		
+		// Fix .part filenames
+		$this->rawPath = Keymanager::fixPartialFilePath( $this->rawPath );
+		
 		if ( 
 		dirname( $this->rawPath ) == 'streams' 
 		and isset( self::$sourceStreams[basename( $this->rawPath )] ) 
@@ -257,11 +260,6 @@ class Stream {
 			
 			$this->plainKey = Crypt::multiKeyDecrypt( $this->encKeyfile, $shareKey, $privateKey );
 			
-// 			trigger_error( '$this->relPath = '.$this->relPath );
-// 			trigger_error( '$this->userId = '.$this->userId);
-// 			trigger_error( '$this->encKeyfile  = '.$this->encKeyfile );
-// 			trigger_error( '$this->plainKey1 = '.var_export($this->plainKey, 1));
-			
 			return true;
 			
 		} else {
@@ -352,12 +350,6 @@ class Stream {
 		// Save the sharekeys
 		Keymanager::setShareKeys( $view, $this->relPath, $this->encKeyfiles['keys'] );
 		
-// 		trigger_error( "\$this->encKeyfiles['data'] = ".$this->encKeyfiles['data'] );
-// 		trigger_error( '$this->relPath = '.$this->relPath );
-// 		trigger_error( '$this->userId = '.$this->userId);
-// 		trigger_error( '$this->encKeyfile  = '.var_export($this->encKeyfiles, 1) );
-// 		trigger_error( '$this->plainKey2 = '.var_export($this->plainKey, 1));
-		
 		// If extra data is left over from the last round, make sure it 
 		// is integrated into the next 6126 / 8192 block
 		if ( $this->writeCache ) {
@@ -420,7 +412,7 @@ class Stream {
 
 				// Clear $data ready for next round
 				$data = '';
-// 
+				
 			} else {
 				
 				// Read the chunk from the start of $data
@@ -428,8 +420,6 @@ class Stream {
 				
 				$encrypted = $this->preWriteEncrypt( $chunk, $this->plainKey );
 				
-				//trigger_error("\$encrypted = $encrypted");
-				
 				// Write the data chunk to disk. This will be 
 				// attended to the last data chunk if the file
 				// being handled totals more than 6126 bytes
@@ -515,9 +505,9 @@ class Stream {
 			\OC\Files\Filesystem::putFileInfo( $this->relPath, array( 'encrypted' => true, 'size' => $this->size ), '' );
 
 		}
-		
-		return fclose( $this->handle );
 
+		return fclose( $this->handle );
+		
 	}
 
 }
diff --git a/apps/files_encryption/lib/util.php b/apps/files_encryption/lib/util.php
index f7bb51a861331374256a935c412e8548bc07ebbe..38b4219f6e2edf6d0e5e1de4f1d4fd9ca3fc77b9 100644
--- a/apps/files_encryption/lib/util.php
+++ b/apps/files_encryption/lib/util.php
@@ -492,7 +492,7 @@ class Util {
 	 * @note Encryption is recursive
 	 */
 	public function encryptAll( $publicKey, $dirPath, $legacyPassphrase = null, $newPassphrase = null ) {
-	
+		
 		if ( $found = $this->findEncFiles( $dirPath ) ) {
 		
 			// Disable proxy to prevent file being encrypted twice