aggregates debugging plus fixes

Debugging of aggregate requests and an attempt at bug fixing.