add else branch in case error in changing selected state