modified getSelectedVariables