diff --git a/library/js/ordernumber.js b/library/js/ordernumber.js
index f05fc49715b8d69e69588b1d85b0dd6763c9b210..70c92e4bc4590a51b9a5ccb8d474a789ecb055a9 100644
--- a/library/js/ordernumber.js
+++ b/library/js/ordernumber.js
@@ -141,7 +141,7 @@ var ajaxAddCounter = function (btn, nrtype) {
     var countername = prompt (ajax_ordernumber.ORDERNUMBER_JS_NEWCOUNTER);
     if (countername != null) {
         var loading = jQuery("img.ordernumber-loading").first().clone().insertAfter(jQuery(btn).find("img.ordernumber-counter-addbtn")).show();
-        var ajxargs = {
+        var ajaxargs = {
             type: "POST",
 			dataType: "json",
             url: ajax_ordernumber.ajax_url,
diff --git a/library/ordernumber_helper.php b/library/ordernumber_helper.php
index 86c2bf50bb1798e335d3f129ec694198cf2e67da..2b504bc7188d0738e66ab80aa4d08f42bc1f68e1 100644
--- a/library/ordernumber_helper.php
+++ b/library/ordernumber_helper.php
@@ -425,7 +425,7 @@ JFactory::getApplication()->enqueueMessage("<pre>Counter Settings: ".print_r($ct
     public function counter_modification_create_row ($type, $counter, $value) {
 		$html=array();
 		$html[] = "	<tr class='counter_row counter_row_$type'>";
-		$html[] = "		<td class='counter_format'>" . htmlentities((string)(($counter=="")?($this->__ ('PLG_ORDERNUMBER_COUNTERLIST_GLOBAL')):$counter)) . "</td>";
+		$html[] = "		<td class='counter_format'>" . (($counter=="")?($this->__ ('PLG_ORDERNUMBER_COUNTERLIST_GLOBAL')):htmlentities($counter)) . "</td>";
 		$html[] = "		<td class='counter_value'>" . htmlentities((string)$value) . "</td>";
 		$html[] = "		<td class='counter_buttons'>";
 		$html[] = "			<div class='ordernumber-ajax-loading'>";