fix in Smoothinggradient calculation