diff --git a/api/src/Vfs/StreamWrapper.php b/api/src/Vfs/StreamWrapper.php
index e445671dcc..0d4e1e55ce 100644
--- a/api/src/Vfs/StreamWrapper.php
+++ b/api/src/Vfs/StreamWrapper.php
@@ -245,8 +245,10 @@ class StreamWrapper implements StreamWrapperIface
 				{
 					self::load_wrapper($scheme);
 				}
-				$url = Vfs::concat($url,substr($parts['path'],strlen($mounted)));
-
+				if (($relative = substr($parts['path'],strlen($mounted))))
+				{
+					$url = Vfs::concat($url,$relative);
+				}
 				// if url contains url parameter, eg. from filesystem streamwrapper, we need to append relative path here too
 				$matches = null;
 				if ($fix_url_query && preg_match('|([?&]url=)([^&]+)|', $url, $matches))
diff --git a/filemanager/inc/class.filemanager_admin.inc.php b/filemanager/inc/class.filemanager_admin.inc.php
index 48373cfb34..8d4cfc6c02 100644
--- a/filemanager/inc/class.filemanager_admin.inc.php
+++ b/filemanager/inc/class.filemanager_admin.inc.php
@@ -180,12 +180,17 @@ class filemanager_admin extends filemanager_ui
 						Vfs::find($content['versionedpath'], array(
 							'show-deleted' => true,
 							'hidden' => true,
-							'path_preg' => '#/\.versions/#',
+							'depth' => true,
+							'path_preg' => '#/\.(attic|versions)/#',
 						)+(!(int)$content['ctime'] ? array() : array(
 							'ctime' => ($content['ctime']<0?'-':'+').(int)$content['ctime'],
 						)), function($path) use (&$deleted, &$errors)
 						{
-							if (Vfs::unlink($path))
+							if (Vfs::is_dir($path))
+							{
+								Vfs::rmdir($path);
+							}
+							elseif (Vfs::unlink($path))
 							{
 								++$deleted;
 							}