Fixed oversight on previous commit

Didn't unset $selected variable after it was set in loop