Take care of peaks close to the image edge