Correctly deal with empty selections and respect the setting while searching