bugfix: selection from multiple always chose last.

This was due to a missing variable assignment.