added some tests for the aggregated field name.
test and fix for undeclared variable.