Sampler - correctly detecting peak index