Fix undefined selectedModules variable