Fixed a bug in aggregation

The bug only showed itself when openmp was not available