fixed issues with discrete variables.