1) added typeof, double func 2) fixed aggregation functions 3) suppressed io exception at close()