Fixed bug in MaxPeaks