diff --git a/CHANGES.md b/CHANGES.md
index e512a1b6d867c6af8f29141333b30cf62cde681f..208342776a01ba36730779808ff7832984b9362f 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -6,6 +6,7 @@ Changes
 
 ### Unreleased
 
+* 2020-08-25 - Changed calling of footer and footnote layouts to fix behat issues.
 * 2020-08-25 - Fixed favicon 404 Error when no individual favicon is uploaded in Boost Campus.
 * 2020-08-19 - Added capability theme/boost_campus:viewhintinhiddencourse for setting showhintcoursehidden.
 * 2020-08-14 - Reduced inflationary call to reset theme caches for the settings.
diff --git a/layout/columns2.php b/layout/columns2.php
index 49743f786bd3ff7ccff6cb55222554d494e98fee..16aa21c05999da3573771f217a1d93ac9fbd4e9f 100644
--- a/layout/columns2.php
+++ b/layout/columns2.php
@@ -169,36 +169,14 @@ ORIGINAL END. */
 
 $templatecontext['firstcollectionlabel'] = $nav->get_collectionlabel();
 
-// MODIFICATION START: Handle additional layout elements.
-// The output buffer is needed to render the additional layout elements now without outputting them to the page directly.
-ob_start();
-
-// Require additional layout files.
-// Add footer blocks and standard footer.
+// MODIFICATION START.
+// Set the template context for the footer and additional layouts.
 require_once(__DIR__ . '/includes/footer.php');
-// Get imageareaitems config.
-$imageareaitems = get_config('theme_boost_campus', 'imageareaitems');
-if (!empty($imageareaitems)) {
-    // Add imagearea layout file.
-    require_once(__DIR__ . '/includes/imagearea.php');
-}
-// Get footnote config.
-$footnote = get_config('theme_boost_campus', 'footnote');
-if (!empty($footnote)) {
-    // Add footnote layout file.
-    require_once(__DIR__ . '/includes/footnote.php');
-}
-
-// Get output buffer.
-$pagebottomelements = ob_get_clean();
-
-// If there isn't anything in the buffer, set the additional layouts string to an empty string to avoid problems later on.
-if ($pagebottomelements == false) {
-    $pagebottomelements = '';
-}
-// Add the additional layouts to the template context.
-$templatecontext['pagebottomelements'] = $pagebottomelements;
+require_once(__DIR__ . '/includes/imagearea.php');
+require_once(__DIR__ . '/includes/footnote.php');
+// MODIFICATION END.
 
+// MODIFICATION START.
 // Render columns2.mustache from boost_campus.
 echo $OUTPUT->render_from_template('theme_boost_campus/columns2', $templatecontext);
 // MODIFICATION END.
diff --git a/layout/includes/footer.php b/layout/includes/footer.php
old mode 100644
new mode 100755
index c7f00855be8f946f11b9695ada028472b5b80345..be7da0d45a8ce45f4637f1509bfb50bffd948117
--- a/layout/includes/footer.php
+++ b/layout/includes/footer.php
@@ -27,49 +27,23 @@ defined('MOODLE_INTERNAL') || die();
 
 $footerblocksetting = get_config('theme_boost_campus', 'footerblocks');
 
-// Setting is set to no footer blocks layout.
-if ($footerblocksetting === '0columns') {
-    echo $OUTPUT->render_from_template('theme_boost_campus/footer', $templatecontext);
-}
-
 // Setting is set to one columns layout.
 if ($footerblocksetting === '1columns') {
-    $footerblock1columns = true;
-
-    $footerleftblockshtml = $OUTPUT->blocks('footer-left');
-
-    $templatecontext['footerleftblocks'] = $footerleftblockshtml;
-    $templatecontext['footerblock1columns'] = $footerblock1columns;
-
-    echo $OUTPUT->render_from_template('theme_boost_campus/footer', $templatecontext);
+    $templatecontext['footerleftblocks'] = $OUTPUT->blocks('footer-left');
+    $templatecontext['footerblock1columns'] = true;
 }
 
 // Setting is set to two columns layout.
 if ($footerblocksetting === '2columns') {
-    $footerblock2columns = true;
-
-    $footerleftblockshtml = $OUTPUT->blocks('footer-left');
-    $footerrightblockshtml = $OUTPUT->blocks('footer-right');
-
-    $templatecontext['footerleftblocks'] = $footerleftblockshtml;
-    $templatecontext['footerrightblocks'] = $footerrightblockshtml;
-    $templatecontext['footerblock2columns'] = $footerblock2columns;
-
-    echo $OUTPUT->render_from_template('theme_boost_campus/footer', $templatecontext);
+    $templatecontext['footerleftblocks'] = $OUTPUT->blocks('footer-left');
+    $templatecontext['footerrightblocks'] = $OUTPUT->blocks('footer-right');
+    $templatecontext['footerblock2columns'] = true;
 }
 
 // Setting is set to three columns layout.
 if ($footerblocksetting === '3columns') {
-    $footerblock3columns = true;
-
-    $footerleftblockshtml = $OUTPUT->blocks('footer-left');
-    $footermiddleblockshtml = $OUTPUT->blocks('footer-middle');
-    $footerrightblockshtml = $OUTPUT->blocks('footer-right');
-
-    $templatecontext['footerleftblocks'] = $footerleftblockshtml;
-    $templatecontext['footermiddleblocks'] = $footermiddleblockshtml;
-    $templatecontext['footerrightblocks'] = $footerrightblockshtml;
-    $templatecontext['footerblock3columns'] = $footerblock3columns;
-
-    echo $OUTPUT->render_from_template('theme_boost_campus/footer', $templatecontext);
+    $templatecontext['footerleftblocks'] = $OUTPUT->blocks('footer-left');
+    $templatecontext['footermiddleblocks'] = $OUTPUT->blocks('footer-middle');
+    $templatecontext['footerrightblocks'] = $OUTPUT->blocks('footer-right');
+    $templatecontext['footerblock3columns'] = true;
 }
diff --git a/layout/includes/footnote.php b/layout/includes/footnote.php
old mode 100644
new mode 100755
index 99aca1eb1e5f7a881215e14a7765decd7b0e7bae..3a27a459816b0dff93c741660b87b5b207208f8e
--- a/layout/includes/footnote.php
+++ b/layout/includes/footnote.php
@@ -33,6 +33,4 @@ if (!html_is_blank($footnotesetting)) {
     $footnotesetting = format_text($footnotesetting);
 
     $templatecontext['footnotesetting'] = $footnotesetting;
-
-    echo $OUTPUT->render_from_template('theme_boost_campus/footnote', $templatecontext);
 }
diff --git a/layout/includes/imagearea.php b/layout/includes/imagearea.php
old mode 100644
new mode 100755
index 7e2925be6ee56165a13e197b455fe45dadcc5181..247897310fdb76cc3585df4ad44cd525dafa5607
--- a/layout/includes/imagearea.php
+++ b/layout/includes/imagearea.php
@@ -31,5 +31,4 @@ $imageareafiles = theme_boost_campus_get_imageareacontent();
 // Only proceed if received array is not empty.
 if (!empty($imageareafiles)) {
     $templatecontext['imageareafiles'] = $imageareafiles;
-    echo $OUTPUT->render_from_template('theme_boost_campus/imagearea', $templatecontext);
 }
diff --git a/layout/login.php b/layout/login.php
index 7989066c6e07c267ce278fc28ce2ba43c60c9063..2d4c3f8264f159a874913d604cfbd31a63aa1350 100644
--- a/layout/login.php
+++ b/layout/login.php
@@ -87,30 +87,13 @@ if ($timedibenable) {
 // MODIFICATION END.
 
 // MODIFICATION START: Handle additional layout elements.
-// The output buffer is needed to render the additional layout elements now without outputting them to the page directly.
-ob_start();
-
-// Include own layout file for the footnote region.
 // The theme_boost/login template already renders the standard footer.
 // The footer blocks and the image area are currently not shown on the login page.
 // Here, we will add the footnote only.
-// Get footnote config.
-$footnote = get_config('theme_boost_campus', 'footnote');
-if (!empty($footnote)) {
-    // Add footnote layout file.
-    require_once(__DIR__ . '/includes/footnote.php');
-}
-
-// Get output buffer.
-$pagebottomelements = ob_get_clean();
-
-// If there isn't anything in the buffer, set the additional layouts string to an empty string to avoid problems later on.
-if ($pagebottomelements == false) {
-    $pagebottomelements = '';
-}
-// Add the additional layouts to the template context.
-$templatecontext['pagebottomelements'] = $pagebottomelements;
+require_once(__DIR__ . '/includes/footnote.php');
+// MODIFICATION END.
 
+// MODIFICATION START.
 // Render own template.
 echo $OUTPUT->render_from_template('theme_boost_campus/login', $templatecontext);
 // MODIFICATION END.
diff --git a/templates/columns2.mustache b/templates/columns2.mustache
index f1a8aab8d9fdfbf8dac1cf42f8e4e887bb8e8348..d9d56bb6be0ab060eb2919e0adae92a7a6bbb4a4 100644
--- a/templates/columns2.mustache
+++ b/templates/columns2.mustache
@@ -71,8 +71,8 @@
     * If setting "showsettingsincourse" is enabled, then render course context menu from theme_boost_campus/settings_link_page
       template and use the equivalent own javascript "incoursesettings".
     * Call to own navbar mustache template instead of boost/navbar.
-    * Add own additional layout elements: the footer, footnote or image area.
-    * Moved the variable output.standard_end_of_body_html from footer.mustache to solve Javascript issues with behat tests.
+    * Use own footer instead of the theme_boost footer.
+    * Add own additional layout elements: footnote or image area.
     * Added the possibility to show information banners.
 }}
 {{> theme_boost/head }}
@@ -141,10 +141,10 @@
         </div>
     </div>
     {{{ output.standard_after_main_region_html }}}
-    {{{ pagebottomelements }}}
+    {{> theme_boost_campus/footer }}
+    {{> theme_boost_campus/imagearea }}
+    {{> theme_boost_campus/footnote }}
 </div>
-{{! Moved the variable here from footer.mustache to solve Javascript issues with behat tests. }}
-{{{ output.standard_end_of_body_html }}}
 
 </body>
 </html>
diff --git a/templates/footer.mustache b/templates/footer.mustache
index ba4a2313edf74913e547be9a8f081343f261a46a..e6f1ddc4209005f81c0d2084329c3f69eacde401 100644
--- a/templates/footer.mustache
+++ b/templates/footer.mustache
@@ -34,7 +34,7 @@
     }
 }}
 {{! MODIFICATION:
-    * Moved the variable output.standard_end_of_body_html to the end of the columns2.mustache template to solve Javascript issues with behat tests.
+    * Add footer blocks.
 }}
 <footer id="page-footer" class="py-3 bg-dark text-light">
     <div class="container-fluid">
@@ -106,9 +106,7 @@
                     {{/ output.custom_menu_flat }}
                 </nav>
                 {{{ output.standard_footer_html }}}
-                {{! Moved the variable
-                output.standard_end_of_body_html
-                to the end of the columns2.mustache template to solve Javascript issues with behat tests. }}
+                {{{ output.standard_end_of_body_html }}}
             </div>
         </div>
     </div>
diff --git a/templates/footnote.mustache b/templates/footnote.mustache
index 17354d11d8c8819983176fc7165b557e3670d9c0..56c1a2f4bdafbbff11644679863257a598ee3b0c 100644
--- a/templates/footnote.mustache
+++ b/templates/footnote.mustache
@@ -28,6 +28,7 @@
     }
 }}
 
+{{# footnotesetting }}
 <div class="footnote p-3 bg-dark text-light">
     <div class="container-fluid">
         <div class="row-fluid">
@@ -35,4 +36,4 @@
         </div>
     </div>
 </div>
-
+{{/ footnotesetting }}
diff --git a/templates/imagearea.mustache b/templates/imagearea.mustache
index e02ad2d8480ec5e245c8d7d27079ebc6df01d2a9..4d8ad44c29eaa8b2e0f4be30d5b4d7da9e03918d 100644
--- a/templates/imagearea.mustache
+++ b/templates/imagearea.mustache
@@ -36,9 +36,10 @@
 
 }}
 
+{{# imageareafiles }}
 <div class="imagearea d-flex justify-content-center flex-wrap pb-3 bg-dark">
     {{#imageareafiles}}
         {{#linkpath}}<a href="{{linkpath}}">{{/linkpath}}<img src="{{filepath}}" class="mt-3" {{#alttext}} alt="{{alttext}}"{{/alttext}}>{{#linkpath}}</a>{{/linkpath}}
     {{/imageareafiles}}
 </div>
-
+{{/ imageareafiles }}
diff --git a/templates/login.mustache b/templates/login.mustache
index 7fa605e745718365cc83a0f6820b57cf816a14e2..7f09db4e0e3b65e60342209aa5cf24c44a4f1430 100644
--- a/templates/login.mustache
+++ b/templates/login.mustache
@@ -100,7 +100,7 @@
             {{{ output.standard_end_of_body_html }}}
         </div>
     </footer>
-    {{{ pagebottomelements }}}
+    {{> theme_boost_campus/footnote }}
 </div>