When the file is not selected, solved the bug as it used to result in error