Fixed discretize script