Handle selected state properly