CRM-13657 : more code improvement needed to be done

----------------------------------------
* CRM-13657: Fatal error when accessing civicase
  http://issues.civicrm.org/jira/browse/CRM-13657