fixed some code for aggreagate object