fix query to pull target ID's instead of source: CRM-13150