diff --git a/.ci/deploy.sh b/.ci/deploy.sh
index 60cfda686821fc48575734cb3a7a6c97b971d963..dbf0c2a447d74046636ca8e8bee1b578acc8bf39 100644
--- a/.ci/deploy.sh
+++ b/.ci/deploy.sh
@@ -7,6 +7,7 @@ echo $rootDir
 
 # clean previous builds
 rm -rf $rootDir/public
+rm -rf $rootDir/theme
 mkdir $rootDir/public
 
 if [[ $CI_COMMIT_BRANCH == "develop" ]]; then
@@ -19,7 +20,6 @@ fi
 
 # build the unstable version - can be optimized
 git submodule update --init --recursive
-git submodule foreach --recursive git reset --hard
 
 # add matomo
 sed -i "/matomohead/r./.ci/analytics/head.html" theme/templates/_index.html
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index a01b57938b1e884c5c2574a6e95336eb95ed66bb..59b834fe86ec086723c44a6a3c6cf1e31529922d 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -61,6 +61,8 @@ build:courses:
   rules:
     - if: $CI_COMMIT_BRANCH == "develop"
     - if: $CI_COMMIT_BRANCH == "master"
+  before_script:
+    - git submodule update --init --recursive
   script:
     - bash .ci/deploy.sh
   artifacts: