account for divide by zero in stats averaging

Previously returned NaN if size array was empty.