Fix bilateralFilter function