fixing bug where we were using the wrong sampleMean index