Fixed selected logic.