bug in refactoring aggregate result