fixed slow part of summing