fixing the bug with getSelectedVariables()