diff --git a/include/friendica_smarty.php b/include/friendica_smarty.php
index 99dc12bf8d..9ba2d2a744 100644
--- a/include/friendica_smarty.php
+++ b/include/friendica_smarty.php
@@ -60,6 +60,8 @@ class FriendicaSmartyEngine implements ITemplateEngine {
 			$template = $s;
 			$s = new FriendicaSmarty();
 		}
+		
+		$r['$APP'] = get_app();
 
 		// "middleware": inject variables into templates
 		$arr = array(
diff --git a/include/text.php b/include/text.php
index 4f3af5aee8..c7681a4d58 100644
--- a/include/text.php
+++ b/include/text.php
@@ -22,7 +22,7 @@ function replace_macros($s,$r) {
 	$a = get_app();
 
 	// pass $baseurl to all templates
-	$r['$baseurl'] = z_root();
+	$r['$baseurl'] = $a->get_baseurl();
 
 
 	$t = $a->template_engine();