diff --git a/module/templates/ce_leaflet_map.html5 b/module/templates/ce_leaflet_map.html5
index df6a289..61563ff 100644
--- a/module/templates/ce_leaflet_map.html5
+++ b/module/templates/ce_leaflet_map.html5
@@ -9,4 +9,5 @@
+' . $this->javascript .''; ?>
diff --git a/module/templates/mod_leaflet_map.html5 b/module/templates/mod_leaflet_map.html5
index e88bc5b..ff792c9 100644
--- a/module/templates/mod_leaflet_map.html5
+++ b/module/templates/mod_leaflet_map.html5
@@ -14,4 +14,4 @@
-
+' . $this->javascript .''; ?>
diff --git a/src/Netzmacht/Contao/Leaflet/Frontend/AbstractMapHybrid.php b/src/Netzmacht/Contao/Leaflet/Frontend/AbstractMapHybrid.php
index 795fcee..ad04a26 100644
--- a/src/Netzmacht/Contao/Leaflet/Frontend/AbstractMapHybrid.php
+++ b/src/Netzmacht/Contao/Leaflet/Frontend/AbstractMapHybrid.php
@@ -120,8 +120,7 @@ abstract class AbstractMapHybrid extends AbstractHybrid
$mapId = $this->getIdentifier();
$map = $this->mapProvider->generate($this->get('leaflet_map'), null, $mapId, $template);
- $GLOBALS['TL_BODY'][] = '';
-
+ $this->template->set('javascript', $map);
$this->template->set('mapId', $mapId);
$style = '';