solved issues with discretization