Fixed bug with aggregate functions

The aggregate database functions were not serializable