fixed another bug: sum was not set to zero when calculating mean several times. (doubler, forgot to remove debug write)