CRM-12266

fixed the missing query bit