add condition to avoid group by scope