fixed bug in group by id sql error and edited some features in addActivi...

...ty