Fixes aggregate with multiple inputs.