Fixed a logical bug, and added exceptions in aggregate