diff --git a/data/CRMEntity.php b/data/CRMEntity.php
index e44091c544dde7fbc32a09acc4536f194818cc22..d57d536f320e39c48de80e55594e92e3a725a48f 100644
--- a/data/CRMEntity.php
+++ b/data/CRMEntity.php
@@ -985,7 +985,7 @@ class CRMEntity {
 
 		//Event triggering code
 		require_once("include/events/include.inc");
-
+		$em = null;
 		//In Bulk mode stop triggering events
 		if(!self::isBulkSaveMode()) {
 			$em = new VTEventsManager($adb);
diff --git a/include/QueryGenerator/EnhancedQueryGenerator.php b/include/QueryGenerator/EnhancedQueryGenerator.php
index 3f6bcb5d52ffad4f4a780d691264bfcf3ff0248c..397f9413aea8ab813d14f7e2ab33861d706b3a0a 100644
--- a/include/QueryGenerator/EnhancedQueryGenerator.php
+++ b/include/QueryGenerator/EnhancedQueryGenerator.php
@@ -90,6 +90,7 @@ class EnhancedQueryGenerator extends QueryGenerator {
 		$dateSpecificConditions = $customView->getStdFilterConditions();
 		$specialDateTimeConditions = Vtiger_Functions::getSpecialDateTimeCondtions();
 		foreach ($advFilterList as $groupindex => $groupcolumns) {
+			if(! $groupcolumns)continue;
 			$filtercolumns = $groupcolumns['columns'];
 			if (php7_count($filtercolumns) > 0) {
 				$this->startGroup('');
diff --git a/include/QueryGenerator/QueryGenerator.php b/include/QueryGenerator/QueryGenerator.php
index 537e28096ddce0e735620f9e2da17a415d3b9e71..e643d17247ed807312cfb86ee9946bb4a2db94b3 100644
--- a/include/QueryGenerator/QueryGenerator.php
+++ b/include/QueryGenerator/QueryGenerator.php
@@ -1340,7 +1340,7 @@ class QueryGenerator {
 
 	public function addUserSearchConditions($input) {
 		global $log,$default_charset;
-		if($input['searchtype']=='advance') {
+		if(isset($input['searchtype']) && $input['searchtype']=='advance') {
 
 			$json = new Zend_Json();
 			$advft_criteria = $_REQUEST['advft_criteria'];
@@ -1387,7 +1387,7 @@ class QueryGenerator {
 				}
 			}
 			$this->endGroup();
-		} elseif($input['type']=='dbrd') {
+		} elseif(isset($input['type']) && $input['type']=='dbrd') {
 			if($this->conditionInstanceCount > 0) {
 				$this->startGroup(self::$AND);
 			} else {
diff --git a/include/events/VTEntityData.inc b/include/events/VTEntityData.inc
index 7d2ac0b0c72186a2dd221ff5e6bcf412e4aad80b..3cc635d015c64227978c1a9e2988c012c106dfb7 100644
--- a/include/events/VTEntityData.inc
+++ b/include/events/VTEntityData.inc
@@ -85,7 +85,7 @@ class VTEntityData{
 
 		// added to compute label needed in event handlers
 		//TODO : need to make sure entity fields are cached
-		$entityFields = Vtiger_Functions::getEntityModuleInfo($crmEntity->moduleName);
+		$entityFields = isset($crmEntity->moduleName) ? Vtiger_Functions::getEntityModuleInfo($crmEntity->moduleName) : array("fieldname" => array());
 		if (!empty($entityFields['fieldname'])) {
 			$entityFieldNames = explode(',', $entityFields['fieldname']);
 			$label = '';
diff --git a/includes/runtime/Viewer.php b/includes/runtime/Viewer.php
index a6148bcc69f3e079adb7f7504a9506b0b98a9e81..201b97ca28bd274d971fee330ef525d0b771c793 100644
--- a/includes/runtime/Viewer.php
+++ b/includes/runtime/Viewer.php
@@ -90,7 +90,7 @@ class Vtiger_Viewer extends Smarty {
 			'array_map', 'array_key_exists', 'get_class', 'vtlib_array', 'getDuplicatesPreventionMessage', 'htmlentities', 'purifyHtmlEventAttributes',
 			'getCurrencySymbolandCRate', 'mb_substr', 'isPermitted', 'getEntityName', 'function_exists', 'php7_trim', 'php7_htmlentities',
 			'strtolower', 'strtoupper', 'str_replace', 'urlencode', 'getTranslatedCurrencyString', 'getTranslatedString', 'is_object', 'is_numeric',
-			'php7_sizeof', 'method_exists','implode','mt_rand');
+			'php7_sizeof', 'method_exists','implode','mt_rand','substr','in_array');
 		foreach ($modifiers as $modifier) {
 			if (function_exists($modifier)) {
 				$this->registerPlugin('modifier', $modifier, $modifier);
diff --git a/layouts/v7/modules/Settings/Vtiger/ModuleHeader.tpl b/layouts/v7/modules/Settings/Vtiger/ModuleHeader.tpl
index 6c9a82a0f83ed633634acee5d258b05ff4d5d773..4a952d7da6785ae629d25d28eb8983483455f7f6 100644
--- a/layouts/v7/modules/Settings/Vtiger/ModuleHeader.tpl
+++ b/layouts/v7/modules/Settings/Vtiger/ModuleHeader.tpl
@@ -68,7 +68,7 @@
                                                                         <a href="">
                                                                             <span class="fa fa-angle-right" aria-hidden="true"></span>&nbsp;
                                                                             {if $REQ->get('view') eq 'Edit'}
-                                                                                    {if $RECORD}
+                                                                                    {if isset($RECORD) && $RECORD}
                                                                                             {vtranslate('LBL_EDITING', $MODULE)} :&nbsp;{$RECORD->getName()}
                                                                                     {else}
                                                                                             {vtranslate('LBL_ADDING_NEW', $MODULE)}
diff --git a/layouts/v7/modules/Settings/Vtiger/Sidebar.tpl b/layouts/v7/modules/Settings/Vtiger/Sidebar.tpl
index 5a4babb060de45dc4ca07f0a12b6518d9ef68a5f..d532a8e0b6ed05405951ad600c1f0d033154e8b9 100644
--- a/layouts/v7/modules/Settings/Vtiger/Sidebar.tpl
+++ b/layouts/v7/modules/Settings/Vtiger/Sidebar.tpl
@@ -26,13 +26,13 @@
 								<div class="app-settings-accordion">
 									<div class="settingsgroup-accordion">
 										<a data-toggle="collapse" data-parent="#accordion" class='collapsed' href="#{$BLOCK_NAME}">
-											<i class="indicator fa{if $ACTIVE_BLOCK['block'] eq $BLOCK_NAME} fa-chevron-down {else} fa-chevron-right {/if}"></i>
+											<i class="indicator fa{if isset($ACTIVE_BLOCK['block']) && $ACTIVE_BLOCK['block'] eq $BLOCK_NAME} fa-chevron-down {else} fa-chevron-right {/if}"></i>
 											&nbsp;<span>{vtranslate($BLOCK_NAME,$QUALIFIED_MODULE)}</span>
 										</a>
 									</div>
 								</div>
 							</div>
-							<div id="{$BLOCK_NAME}" class="panel-collapse collapse ulBlock {if $ACTIVE_BLOCK['block'] eq $BLOCK_NAME} in {/if}">
+							<div id="{$BLOCK_NAME}" class="panel-collapse collapse ulBlock {if isset($ACTIVE_BLOCK['block']) && $ACTIVE_BLOCK['block'] eq $BLOCK_NAME} in {/if}">
 								<ul class="list-group widgetContainer">
 									{foreach item=MENUITEM from=$BLOCK_MENU_ITEMS}
 										{assign var=MENU value= $MENUITEM->get('name')}
@@ -53,7 +53,7 @@
 											{assign var=MENU_URL value=$USER_MODEL->getCalendarSettingsDetailViewUrl()}
 										{/if}
 										<li>
-											<a data-name="{$MENU}" href="{$MENU_URL}" class="menuItemLabel {if $ACTIVE_BLOCK['menu'] eq $MENU} settingsgroup-menu-color {/if}">
+											<a data-name="{$MENU}" href="{$MENU_URL}" class="menuItemLabel {if isset($ACTIVE_BLOCK['menu']) && $ACTIVE_BLOCK['menu'] eq $MENU} settingsgroup-menu-color {/if}">
 												{vtranslate($MENU_LABEL,$QUALIFIED_MODULE)}
 												<img id="{$MENUITEM->getId()}_menuItem" data-id="{$MENUITEM->getId()}" class="pinUnpinShortCut cursorPointer pull-right"
 													 data-actionurl="{$MENUITEM->getPinUnpinActionUrl()}"
diff --git a/layouts/v7/modules/Users/DeleteUser.tpl b/layouts/v7/modules/Users/DeleteUser.tpl
index 826b8ddfb8d43af1e29509391183d044d79a8347..a5c81d0da55c8096555483f9de243c3918b5aea5 100644
--- a/layouts/v7/modules/Users/DeleteUser.tpl
+++ b/layouts/v7/modules/Users/DeleteUser.tpl
@@ -35,7 +35,7 @@
                        </div>
                     </div>
                                 
-                    {if !$PERMANENT}        
+                    {if !isset($PERMANENT)|| !$PERMANENT }        
                         <div class="form-group">
                             <label class="control-label fieldLabel col-sm-4"></label>
                                 <div class="controls fieldValue col-sm-8">
diff --git a/layouts/v7/modules/Users/ListViewContents.tpl b/layouts/v7/modules/Users/ListViewContents.tpl
index 85daa267ae833e8f0a931edba5a73bc2286566b3..be64f31550178cc7ad40b4ccb763f1158248920d 100644
--- a/layouts/v7/modules/Users/ListViewContents.tpl
+++ b/layouts/v7/modules/Users/ListViewContents.tpl
@@ -20,14 +20,14 @@
 	<input type="hidden" id="numberOfEntries" value= "{$LISTVIEW_ENTRIES_COUNT}" />
 	<input type="hidden" id="alphabetSearchKey" value= "{$MODULE_MODEL->getAlphabetSearchField()}" />
 	<input type="hidden" id="Operator" value="{$OPERATOR}" />
-	<input type="hidden" id="alphabetValue" value="{$ALPHABET_VALUE}" />
+	<input type="hidden" id="alphabetValue" value="{(isset($ALPHABET_VALUE)) ? $ALPHABET_VALUE : ''}" />
 	<input type="hidden" id="totalCount" value="{$LISTVIEW_COUNT}" />
 	<input type="hidden" name="orderBy" value="{$ORDER_BY}" id="orderBy">
 	<input type="hidden" name="sortOrder" value="{$SORT_ORDER}" id="sortOrder">
 	<input type='hidden' value="{$PAGE_NUMBER}" id='pageNumber'>
 	<input type='hidden' value="{$PAGING_MODEL->getPageLimit()}" id='pageLimit'>
 	<input type="hidden" value="{$LISTVIEW_ENTRIES_COUNT}" id="noOfEntries">
-	<input type="hidden" value="{$NO_SEARCH_PARAMS_CACHE}" id="noFilterCache" >
+	<input type="hidden" value="{(isset($NO_SEARCH_PARAMS_CACHE)) ? $NO_SEARCH_PARAMS_CACHE : ''}" id="noFilterCache" >
 
 	<div id="table-content" class="table-container">
 		<form name='list' id='listedit' action='' onsubmit="return false;">
@@ -83,8 +83,12 @@
 								{/if}
 								<th>
 									{assign var=FIELD_UI_TYPE_MODEL value=$LISTVIEW_HEADER->getUITypeModel()}
-									{include file=vtemplate_path($FIELD_UI_TYPE_MODEL->getListSearchTemplateName(),$MODULE) FIELD_MODEL= $LISTVIEW_HEADER SEARCH_INFO=$SEARCH_DETAILS[$LISTVIEW_HEADER->getName()] USER_MODEL=$CURRENT_USER_MODEL}
-									<input type="hidden" class="operatorValue" value="{$SEARCH_DETAILS[$LISTVIEW_HEADER->getName()]['comparator']}">
+									{assign var=FIELD_SEARCH_INFO value=array("searchValue" => "","comparator" => "")}
+									{if isset($SEARCH_DETAILS[$LISTVIEW_HEADER->getName()])}
+										{assign var="FIELD_SEARCH_INFO" value=$SEARCH_DETAILS[$LISTVIEW_HEADER->getName()]}
+									{/if}
+									{include file=vtemplate_path($FIELD_UI_TYPE_MODEL->getListSearchTemplateName(),$MODULE) FIELD_MODEL= $LISTVIEW_HEADER SEARCH_INFO=$FIELD_SEARCH_INFO USER_MODEL=$CURRENT_USER_MODEL}
+									<input type="hidden" class="operatorValue" value="{$FIELD_SEARCH_INFO['comparator']}">
 								</th>
 							{/foreach}
 						</tr>
@@ -127,7 +131,7 @@
 										</span>
 									</td>
 								{elseif $LISTVIEW_HEADER->getName() neq 'last_name' and $LISTVIEW_HEADER->getName() neq 'email1' and $LISTVIEW_HEADER->getName() neq 'status'}
-									<td class="{$WIDTHTYPE}" nowrap>
+									<td class="{(isset($WIDTHTYPE)) ? $WIDTHTYPE : ''}" nowrap>
 										<span class="fieldValue">
 											<span class="value textOverflowEllipsis">
 												{$LISTVIEW_ENTRY->get($LISTVIEW_HEADERNAME)}
diff --git a/layouts/v7/modules/Users/UserViewHeader.tpl b/layouts/v7/modules/Users/UserViewHeader.tpl
index 754487eb3507f85796fa72369cc331f19a1383f1..5043cee92644ff5caf66b078873c9843073d684a 100644
--- a/layouts/v7/modules/Users/UserViewHeader.tpl
+++ b/layouts/v7/modules/Users/UserViewHeader.tpl
@@ -38,14 +38,15 @@
                 </div>
                 <div class="pull-right col-md-7 detailViewButtoncontainer">
                     <div class="btn-group pull-right">
-                        {foreach item=DETAIL_VIEW_BASIC_LINK from=$DETAILVIEW_LINKS['DETAILVIEWBASIC']}
+                    {if isset($DETAILVIEW_LINKS)}
+                            {foreach item=DETAIL_VIEW_BASIC_LINK from=$DETAILVIEW_LINKS['DETAILVIEWBASIC']}
                             <button class="btn btn-default {if $DETAIL_VIEW_BASIC_LINK->getLabel() eq 'LBL_EDIT'}{/if}" id="{$MODULE}_detailView_basicAction_{Vtiger_Util_Helper::replaceSpaceWithUnderScores($DETAIL_VIEW_BASIC_LINK->getLabel())}"
                                     {if $DETAIL_VIEW_BASIC_LINK->isPageLoadLink()}
                                         onclick="window.location.href='{$DETAIL_VIEW_BASIC_LINK->getUrl()}'"
                                     {else}
                                         onclick="{$DETAIL_VIEW_BASIC_LINK->getUrl()}"
                                     {/if}>
-                               {vtranslate($DETAIL_VIEW_BASIC_LINK->getLabel(), $MODULE)}
+                            {vtranslate($DETAIL_VIEW_BASIC_LINK->getLabel(), $MODULE)}
                             </button>
                         {/foreach}
                         {if $DETAILVIEW_LINKS['DETAILVIEW']|@count gt 0}
@@ -67,6 +68,7 @@
                                 {/foreach}
                             </ul>
                         {/if}
+                    {/if}
                     </div>
                 </div>
             </div>
diff --git a/modules/Settings/Vtiger/models/Module.php b/modules/Settings/Vtiger/models/Module.php
index 4a9f38848cee583f5d7351c8daeebfb261f416cb..2d044513d4927ebe003905d945aeb29bd588575d 100644
--- a/modules/Settings/Vtiger/models/Module.php
+++ b/modules/Settings/Vtiger/models/Module.php
@@ -195,7 +195,7 @@ class Settings_Vtiger_Module_Model extends Vtiger_Base_Model {
 
 	public function getSettingsActiveBlock($viewName) {
 		$blocksList = array('OutgoingServerEdit' => array('block' => 'LBL_CONFIGURATION', 'menu' => 'LBL_MAIL_SERVER_SETTINGS'));
-		return $blocksList[$viewName];
+		return isset($blocksList[$viewName]) ? $blocksList[$viewName] : null;
 	}
 
 	public function getModuleIcon() {
diff --git a/modules/Users/Users.php b/modules/Users/Users.php
index b88c9f8dc80954a434a3bfd912e5f44acd5a69dd..9b1ee1067f691ac91e652404a22545afb677f4ed 100755
--- a/modules/Users/Users.php
+++ b/modules/Users/Users.php
@@ -123,6 +123,8 @@ class Users extends CRMEntity {
 	var $record_id;
 	var $new_schema = true;
 
+	public $moduleName;
+
 	var $DEFAULT_PASSWORD_CRYPT_TYPE; //'BLOWFISH', /* before PHP5.3*/ MD5;
 
 	//Default Widgests
@@ -1725,7 +1727,7 @@ class Users extends CRMEntity {
 			foreach($fieldInstances as $blockInstance) {
 				foreach($blockInstance as $fieldInstance) {
 					$fieldName = $fieldInstance->getName();
-					$fieldValue = $data[$fieldName];
+					$fieldValue = isset($data[$fieldName]) ? $data[$fieldName] : '';
 					$dataType = $fieldInstance->getFieldDataType();
 					if($fieldInstance->isMandatory()) {
 						$mandatoryFields[] = $fieldName;
@@ -1767,6 +1769,7 @@ class Users extends CRMEntity {
 							unset($currencyId);
 					} else if($fieldName == 'language') {
 						foreach($allLanguages as $langKey => $langName) {
+							if(isset($fieldValue) && isset($langKey) && isset($langName))continue;
 							if(strtolower($fieldValue) == strtolower($langKey) || strtolower($fieldValue) == strtolower($langName)) {
 								$lang = $langKey;
 								break;
@@ -1781,6 +1784,10 @@ class Users extends CRMEntity {
 						$allUsers = Users_Record_Model::getAll();
 						$reportsTo = null;
 						foreach($allUsers as $user) {
+							
+							if (!$user->get('user_name') && !$user->get('userlabel')) {
+								continue;
+							}
 							$userName = strtolower($user->get('user_name'));
 							$firstLastName = strtolower($user->get('userlabel'));
 							if(strtolower($fieldValue) == $userName || strtolower($fieldValue) == $firstLastName) {
@@ -1795,6 +1802,7 @@ class Users extends CRMEntity {
 						$picklistValues = $fieldInstance->getPicklistValues();
 						$emptyValuedPicklistFields = array('defaulteventstatus', 'defaultactivitytype', 'reminder_interval');
 						foreach($picklistValues as $picklistKey => $picklistValue) {
+							if(!$fieldValue && !$picklistValue && !$picklistKey) continue;
 							if(strtolower($fieldValue) == strtolower($picklistKey) || strtolower($fieldValue) == strtolower($picklistValue)) {
 								$selectedValue = $picklistKey;
 								break;
@@ -1843,7 +1851,7 @@ class Users extends CRMEntity {
 				$modelData = $recordModel->getData();
 				$recordModel->set('mode', '');
 				foreach($modelData as $fieldName => $fieldValue) {
-					$recordModel->set($fieldName, $record[$fieldName]);
+					$recordModel->set($fieldName, isset($record[$fieldName]) ? $record[$fieldName] : null);
 				}
 				$recordModel->save();
 				$plainPasswords[$recordModel->getId()] = $record['user_password'];
diff --git a/modules/Users/models/Module.php b/modules/Users/models/Module.php
index 8d881dbf70ee9acf648137fa344a805747413eb1..400452d424dac0522c1504cb2e67d74a960f5721 100644
--- a/modules/Users/models/Module.php
+++ b/modules/Users/models/Module.php
@@ -332,7 +332,7 @@ class Users_Module_Model extends Vtiger_Module_Model {
 		$blocksList = array('Edit'			=> array('block' => 'LBL_USER_MANAGEMENT', 'menu' => 'LBL_USERS'),
 							'Calendar'		=> array('block' => 'LBL_MY_PREFERENCES', 'menu' => 'Calendar Settings'),
 							'PreferenceEdit'=> array('block' => 'LBL_MY_PREFERENCES', 'menu' => 'My Preferences'));
-		return $blocksList[$viewName];
+		return isset($blocksList[$viewName]) ? $blocksList[$viewName] :null;
 	}
 
 	/**
diff --git a/modules/Users/views/List.php b/modules/Users/views/List.php
index 1a0edc4264351ac7e8bee114a439a98869424189..f2427eda1accb98e3938a1ffd0d4c017d69ff5dc 100644
--- a/modules/Users/views/List.php
+++ b/modules/Users/views/List.php
@@ -130,7 +130,7 @@ class Users_List_View extends Settings_Vtiger_List_View {
 		}
 		$viewer->assign('LISTVIEW_LINKS', $this->listViewLinks);
 
-		$viewer->assign('LISTVIEW_MASSACTIONS', $linkModels['LISTVIEWMASSACTION']);
+		$viewer->assign('LISTVIEW_MASSACTIONS', isset($linkModels['LISTVIEWMASSACTION']) ? $linkModels['LISTVIEWMASSACTION'] : '');
 
 		$viewer->assign('PAGING_MODEL', $pagingModel);
 		$viewer->assign('PAGE_NUMBER',$pageNumber);
diff --git a/modules/Vtiger/models/ModuleMeta.php b/modules/Vtiger/models/ModuleMeta.php
index 7da3f8c4c5382fd955cb85b74983848c1ee7ef6c..700e439540354882a7655638329a95f67897a789 100644
--- a/modules/Vtiger/models/ModuleMeta.php
+++ b/modules/Vtiger/models/ModuleMeta.php
@@ -96,7 +96,7 @@ class Vtiger_ModuleMeta_Model extends Vtiger_Base_Model {
 			// TODO - Cleanup this once Query Generator support is corrected
 			if($fieldInstance->getFieldDataType() == 'reference') {
 				$referencedModules = $fieldInstance->getReferenceList();
-				if($referencedModules[0] == 'Users') {
+				if(isset($referencedModules[0]) && $referencedModules[0] == 'Users') {
 					continue;
 				}
 			}
diff --git a/modules/com_vtiger_workflow/VTEntityCache.inc b/modules/com_vtiger_workflow/VTEntityCache.inc
index 15d24c6e93aeae5caf4da88bfe5efa9f322d7dc5..b8e073f267102fe67df0cdf38246a2941650e99c 100644
--- a/modules/com_vtiger_workflow/VTEntityCache.inc
+++ b/modules/com_vtiger_workflow/VTEntityCache.inc
@@ -76,7 +76,7 @@ class VTWorkflowEntity{
 
 		if($this->moduleName==null){
 			global $adb;
-			$wsId = $this->data['id'];
+			$wsId = isset($this->data['id']) ? $this->data['id'] : '';
 			$parts = explode('x', $wsId);
 			if($cache->getModuleName($parts[0])){
 				$this->moduleName=$cache->getModuleName($parts[0]);
@@ -84,7 +84,7 @@ class VTWorkflowEntity{
 			$result = $adb->pquery('select name from vtiger_ws_entity where id=?',
 						 array($parts[0]));
 			$rowData = $adb->raw_query_result_rowdata($result, 0);
-			$this->moduleName = $rowData['name'];
+			$this->moduleName = isset($rowData['name']) ? $rowData['name'] : '';
 				$cache->setModuleName($parts[0],  $this->moduleName);
 			}
 		}
diff --git a/pkg/vtiger/modules/Import/layouts/v7/modules/Import/ImportAdvanced.tpl b/pkg/vtiger/modules/Import/layouts/v7/modules/Import/ImportAdvanced.tpl
index 32e4210fa805d6e0af07a9396a0931bfa3485dd3..210e175d299afe283e73430d32f57634423d7b8a 100644
--- a/pkg/vtiger/modules/Import/layouts/v7/modules/Import/ImportAdvanced.tpl
+++ b/pkg/vtiger/modules/Import/layouts/v7/modules/Import/ImportAdvanced.tpl
@@ -45,7 +45,7 @@
                          ACTIVESTEP=3 BREADCRUMB_LABELS=$LABELS MODULE=$MODULE}
                 <div class = "importBlockContainer">
                     <table class = "table table-borderless">
-                        {if $ERROR_MESSAGE neq ''}
+                        {if isset($ERROR_MESSAGE) && $ERROR_MESSAGE neq ''}
                             <tr>
                                 <td align="left">
                                     {$ERROR_MESSAGE}
diff --git a/vtlib/Vtiger/AccessControl.php b/vtlib/Vtiger/AccessControl.php
index 6a1d013cf9c3b03d0839fd7698ca7c25c06f4c6b..2a6ea7ed502527b347183bbf92180f3bd22396b1 100644
--- a/vtlib/Vtiger/AccessControl.php
+++ b/vtlib/Vtiger/AccessControl.php
@@ -49,7 +49,7 @@ class Vtiger_AccessControl {
 			self::$singleton = new self();
 		}
 
-		if (self::$singleton->privileges && self::$singleton->privileges[$id]) {
+		if ( self::$singleton->privileges ) {
 			unset(self::$singleton->privileges[$id]);
 		}
 	}