bugfix: codegen makes incorrect code if aggregate function reference params