diff --git a/video_prediction_tools/JSC_scripts/data_extraction_era5_template.sh b/video_prediction_tools/JSC_scripts/data_extraction_era5_template.sh
index ec226b48f0248eb5df8792102c1f8de2d3817b39..a57bbcaa24f9695473284293d1b4ea1f88674dd2 100644
--- a/video_prediction_tools/JSC_scripts/data_extraction_era5_template.sh
+++ b/video_prediction_tools/JSC_scripts/data_extraction_era5_template.sh
@@ -23,8 +23,7 @@ jutil env activate -p deepacf
 # Name of virtual environment 
 VIRT_ENV_NAME="my_venv"
 
-# Loading mouldes
-source ../env_setup/modules_preprocess+extract.sh
+
 # Activate virtual environment if needed (and possible)
 if [ -z ${VIRTUAL_ENV} ]; then
    if [[ -f ../virtual_envs/${VIRT_ENV_NAME}/bin/activate ]]; then
@@ -35,6 +34,8 @@ if [ -z ${VIRTUAL_ENV} ]; then
       exit 1
    fi
 fi
+# Loading mouldes
+source ../env_setup/modules_preprocess+extract.sh
 
 # Declare path-variables (dest_dir will be set and configured automatically via generate_runscript.py)
 source_dir=/my/path/to/era5