diff --git a/apps/files_versions/lib/hooks.php b/apps/files_versions/lib/hooks.php
index 7891b20e92fd2a74e6a28c3cd18d00a1e3efd9db..6e81286052fc059c3e984e3b2993f6e7b7164331 100644
--- a/apps/files_versions/lib/hooks.php
+++ b/apps/files_versions/lib/hooks.php
@@ -21,6 +21,12 @@ class Hooks {
 
 		if(\OCP\Config::getSystemValue('files_versions', Storage::DEFAULTENABLED)=='true') {
 			$path = $params[\OC\Files\Filesystem::signal_param_path];
+			$pos = strrpos($path, '.part');
+			if ($pos) {
+				error_log("old path: $path");
+				$path = substr($path, 0, $pos);
+				error_log("new path: $path");
+			}
 			if($path<>'') {
 				Storage::store($path);
 			}
diff --git a/apps/files_versions/lib/versions.php b/apps/files_versions/lib/versions.php
index c37133cf32ccaae54548b4c148dff4a5a566099e..274f38095db9916ed89d7d55af08e0671680f37c 100644
--- a/apps/files_versions/lib/versions.php
+++ b/apps/files_versions/lib/versions.php
@@ -107,6 +107,7 @@ class Storage {
 
 			// store a new version of a file
 			$users_view->copy('files'.$filename, 'files_versions'.$filename.'.v'.$users_view->filemtime('files'.$filename));
+			error_log("version created!");
 			$versionsSize = self::getVersionsSize($uid);
 			if (  $versionsSize === false || $versionsSize < 0 ) {
 				$versionsSize = self::calculateSize($uid);
diff --git a/lib/files/view.php b/lib/files/view.php
index 3e2cb080e1dbd745bd5e666078ba5fca7841981c..59339ff207193bc818195d8a06fff539ba19beb2 100644
--- a/lib/files/view.php
+++ b/lib/files/view.php
@@ -245,7 +245,14 @@ class View {
 		if (!is_null($mtime) and !is_numeric($mtime)) {
 			$mtime = strtotime($mtime);
 		}
-		return $this->basicOperation('touch', $path, array('write'), $mtime);
+		
+		$hooks = array('touch');
+		
+		if (!$this->file_exists($path)) {
+			$hooks[] = 'write';
+		}
+		
+		return $this->basicOperation('touch', $path, $hooks, $mtime);
 	}
 
 	public function file_get_contents($path) {
@@ -596,6 +603,7 @@ class View {
 			if ($path == null) {
 				return false;
 			}
+			foreach ($hooks as $h) if ($h == "write") error_log("write triggered by $operation for $path");
 			$run = $this->runHooks($hooks, $path);
 			list($storage, $internalPath) = Filesystem::resolvePath($absolutePath . $postFix);
 			if ($run and $storage) {