Fix position conversion in peak_detector