fix group by and add features