bug fixed adding group by clause