fixed some bugs

added the activities automatically
added the measures vars, aggregation function