fixes for CRM-12956, bug in calculating custom field id

----------------------------------------
* CRM-12956: CiviCRM custom fields (with selects) in Views are a mess
  http://issues.civicrm.org/jira/browse/CRM-12956