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
Merge pull request #115 from kurund/CRM-12956

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