fixed peaksToFile()