Make sure aggregatedStats exists before trying to access it. Fixes issue #2