Fix aggregate register function