diff --git a/tests/test_backup.py b/tests/test_backup.py
index cbd68fdf2356be9d4424607bd6c313235ef3d40f..7497a8cb083797e6f626f0c024054c8c6e5a04a8 100755
--- a/tests/test_backup.py
+++ b/tests/test_backup.py
@@ -70,8 +70,8 @@ def test_backup_space(server):
 def check_local_backup(path):
     all_ok = True
     for d in os.listdir(path):
-        if os.path.isdir(d):
-            subd = os.path.join(path, d)
+        subd = os.path.join(path, d)
+        if os.path.isdir(subd):
             latest = os.path.join(subd, 'latest')
             print('Checking %s' % latest)
             if os.path.exists(latest):
@@ -86,8 +86,8 @@ def check_local_backup(path):
                     print('Backup %s is fine' % subd)
             else:
                 for dd in os.listdir(subd):
-                    if os.path.isdir(dd):
-                        subsubd = os.path.join(subd, dd)
+                    subsubd = os.path.join(subd, dd)
+                    if os.path.isdir(subsubd):
                         all_ok = min(all_ok, check_local_backup(subsubd))
     return all_ok
 
@@ -98,7 +98,7 @@ def check_local_backups(paths):
     folders = paths.split(',')
     for f in folders:
         if f not in blacklist:
-            print('Checking folder %s' % f)
+            print('Checking top folder %s' % f)
             all_ok = min(check_local_backup(f), all_ok)
     return all_ok