added check if anything was selected in main window