Fix ValueError in pulseheight fit