lots of little updates, fixed count and sum

please check!