diff --git a/src/Handler.php b/src/Handler.php
index 1cd655f599c767be1e1255a3b22eed7f9ad10728..387953b49215d4fe6c1226ea77ed4017d02e3a73 100644
--- a/src/Handler.php
+++ b/src/Handler.php
@@ -244,7 +244,7 @@ class Handler extends BaseHandler {
       // Update config for production build.
       if (getenv('LAKEDROPS_BUILD_NG') === 'yes') {
         $config = $handler->getConfig();
-        $isStaging = !in_array(getenv('PROJECT_BRANCH_SANITIZED'), ['master', 'main'], TRUE);
+        $isStaging = !in_array(getenv('CI_COMMIT_REF_SLUG'), ['master', 'main'], TRUE);
         $root = '/drupal/' . getenv('CI_PROJECT_ID') . '/' . getenv('CI_COMMIT_BRANCH');
         $drupal = $this->config->readValue('drupal');
         $drupal['live'] = $config->readValue('live');
@@ -257,6 +257,7 @@ class Handler extends BaseHandler {
             'schedule' => '5 0 * * *',
             'command' => 'cd /var/www/html && /usr/local/bin/drush sql:dump --result-file=/var/backups/mysql/drupal.sql',
           ];
+          $crontabs['enable_mysql_backup'] = TRUE;
         }
         $crontabs['enable'] = (array_sum(array_map('count', $crontabs)) > 0);
         $this->config->setValue('crontabs', $crontabs, FALSE);
diff --git a/templates/docker-compose.yml.twig b/templates/docker-compose.yml.twig
index 758d0aa81873749097108236686e503bac5ddde6..9295a2b31295936c67614e23ddd01dd1481a6603 100644
--- a/templates/docker-compose.yml.twig
+++ b/templates/docker-compose.yml.twig
@@ -90,7 +90,7 @@ services:
       - {{ projectroot }}/drush:/etc/drush
 {% if drupal.live|default(0) %}
       - {{ projectrootfiles }}:/data/default
-{% if backup.enable|default(0) %}
+{% if crontabs.enable_mysql_backup|default(0) %}
       - {{ projectrootfiles }}/db:/var/backups/mysql
 {% endif %}
 {% endif %}