fix to divide-by-zero if no valid samples found