--fixed for CRM-12141

sending new PR with merging code of PR https://github.com/civicrm/civicrm-core/pull/206