diff --git a/data/CRMEntity.php b/data/CRMEntity.php
index 3a096d823147af80441a22dc76328af30aa23191..735352102962c1228a7c66238025f718c80612fc 100644
--- a/data/CRMEntity.php
+++ b/data/CRMEntity.php
@@ -3125,6 +3125,7 @@ class TrackableObject implements ArrayAccess, IteratorAggregate {
 	}
 
 	function offsetSet($key, $value) {
+            if(is_array($value)) $value = empty($value) ? "" : $value[0];
 		if($this->tracking && $this->trackingEnabled) {
 			$olderValue = $this->offsetGet($key);
 			// decode_html only expects string
diff --git a/includes/http/Request.php b/includes/http/Request.php
index bc8b766f5d6fb0a1e0c328dfbfe263cd85cd8f1d..c8282f7512a3350ca04c9e56351fa226f79db351 100644
--- a/includes/http/Request.php
+++ b/includes/http/Request.php
@@ -72,13 +72,8 @@ class Vtiger_Request implements ArrayAccess {
 			}
 		}
 		if($isJSON) {
-			$oldValue = Zend_Json::$useBuiltinEncoderDecoder;
-			Zend_Json::$useBuiltinEncoderDecoder = false;
 			$decodeValue = json_decode($value, true);
-			if(isset($decodeValue)) {
-				$value = $decodeValue;
-			}
-			Zend_Json::$useBuiltinEncoderDecoder  = $oldValue;
+                        $value = json_last_error() ? $value : $decodeValue;
 		}
 
         //Handled for null because vtlib_purify returns empty string
diff --git a/modules/Vtiger/handlers/CheckDuplicateHandler.php b/modules/Vtiger/handlers/CheckDuplicateHandler.php
index db45150109d852acfb7f67e8c81aa065e600c21a..45bafffb449882bbdb1af64760e956928de6c9d5 100644
--- a/modules/Vtiger/handlers/CheckDuplicateHandler.php
+++ b/modules/Vtiger/handlers/CheckDuplicateHandler.php
@@ -139,6 +139,7 @@ class CheckDuplicateHandler extends VTEventHandler {
 
 						$fieldValue = $uniqueFieldsData[$fieldName];
 						if (isset($fieldValue)) {
+                                                        if(is_array($fieldValue)) $fieldValue = empty($fieldValue) ? "" : $fieldValue;
 							array_push($conditions, "$fieldTableName.$fieldColumnName = ?");
 						} else {
 							$fieldValue = '';