denoiseprofile: better fix, more in the spirit of the original patch.