diff --git a/templates/nextcloud-config.yaml b/templates/nextcloud-config.yaml
index 2872413aa7060016a6af970dcadde986ddccdf6b..85df2bf63e95e77424973287df50550043792ab8 100644
--- a/templates/nextcloud-config.yaml
+++ b/templates/nextcloud-config.yaml
@@ -42,6 +42,8 @@ data:
     # Debug: place the json file in a persistent location for reuse
     cp /var/local/onlyoffice-config.json /var/www/html/
     cp /var/local/social-login-config.json /var/www/html/
+    cd /var/www/html
+
     {{- range .Values.apps }}
     # -- Begin {{ .name }}
     # Only install {{ .name }} if it's not installed already
@@ -50,7 +52,6 @@ data:
     fi
     {{- if .enabled }}
     # Enable {{ .name }} app
-    cd /var/www/html
     php occ app:enable {{ .name }}
     {{ end }} # -- end {{ .name }}
     {{ end }} # end range {{ .Values.apps }}