diff --git a/server/conf/bind_named.conf.local.master b/server/conf/bind_named.conf.local.master
index 7815bc29d46c8670bdf534f9a11175479fdc8cda..c8eb70f9bec2521eab1cd3ac6ace84d59da68c85 100644
--- a/server/conf/bind_named.conf.local.master
+++ b/server/conf/bind_named.conf.local.master
@@ -1,7 +1,9 @@
 
 <tmpl_loop name='zones'>
+<tmpl_if name='zone'>
 zone "<tmpl_var name='zone'>" {
         type master;
         file "<tmpl_var name='zonefile_path'>";
 };
+</tmpl_if>
 </tmpl_loop>
diff --git a/server/plugins-available/bind_plugin.inc.php b/server/plugins-available/bind_plugin.inc.php
index 87c99a7cdb922da46425ec4004ca594458e00a62..4ab9b48cfa12cfa317acbd293bd4a9c525dae2fd 100644
--- a/server/plugins-available/bind_plugin.inc.php
+++ b/server/plugins-available/bind_plugin.inc.php
@@ -134,7 +134,7 @@ class bind_plugin {
 		$this->write_named_conf($data,$dns_config);
 		
 		//* Delete the domain file
-		$filename = $dns_config['bind_zonefiles_dir'].'/pri.'.$data['old']['origin'];
+		$filename = $dns_config['bind_zonefiles_dir'].'/pri.'.substr($data['old']['origin'],0,-1);
 		if(is_file($filename)) unset($filename);
 		$app->log("Deleting BIND domain file: ".$filename,LOGLEVEL_DEBUG);