fix for calculate total of samples