diff --git a/resources/assets/javascripts/lib/files.js b/resources/assets/javascripts/lib/files.js
index 59ae95f52e1ac41d77617013c1974354ad56824a..716219e9a359b6234ba113e90e28a44d1ab53cf9 100644
--- a/resources/assets/javascripts/lib/files.js
+++ b/resources/assets/javascripts/lib/files.js
@@ -39,7 +39,7 @@ const Files = {
         //tables are displayed in one page.
         var tables = jQuery('.vue-file-table');
         if (tables.length) {
-            for (var table of tables) {
+            for (let table of tables) {
                 STUDIP.Vue.load().then(({createApp}) => {
                     createApp({
                         el: table,
@@ -342,4 +342,4 @@ const Files = {
     }
 };
 
-export default Files;
\ No newline at end of file
+export default Files;
diff --git a/resources/vue/components/FilesTable.vue b/resources/vue/components/FilesTable.vue
index 76d0be6a0dd4cff8887ac9aa90a6d38ea4f32af2..44605013b2a63b10e4737da9ccb26e0fa18ea43a 100644
--- a/resources/vue/components/FilesTable.vue
+++ b/resources/vue/components/FilesTable.vue
@@ -369,19 +369,21 @@ export default {
     watch: {
         selectedIds (current) {
             const activated = current.length > 0;
-            this.$nextTick(() => { // needs to be wrapped since we check the dom
-                this.$refs.buttons.querySelectorAll('.multibuttons .button').forEach(element => {
-                    let condition = element.dataset.activatesCondition;
-                    if (!condition || !activated) {
-                        element.disabled = !activated;
-                    } else {
-                        condition = condition.replace(/:has\((.*?)\)/g, ' $1');
-                        condition = condition.replace(':checkbox', 'input[type="checkbox"]');
+            if (this.$refs.buttons) {
+                this.$nextTick(() => { // needs to be wrapped since we check the dom
+                    this.$refs.buttons.querySelectorAll('.multibuttons .button').forEach(element => {
+                        let condition = element.dataset.activatesCondition;
+                        if (!condition || !activated) {
+                            element.disabled = !activated;
+                        } else {
+                            condition = condition.replace(/:has\((.*?)\)/g, ' $1');
+                            condition = condition.replace(':checkbox', 'input[type="checkbox"]');
 
-                        element.disabled = this.$el.querySelector(condition) === null;
-                    }
+                            element.disabled = this.$el.querySelector(condition) === null;
+                        }
+                    });
                 });
-            });
+            }
         },
     }
 }