fixed so works with smaller than 100 samples