fix error clause, and failing aggregate test

error messages were not getting handled correctly.