selected array should be reinitialized on each
iteration of i to avoid more than one "selected" operator
in the dropdown.

As posted by Octavio Alvarez.