fix denoise function