Fix #495, use set_name from element query.

Avoids an extremely large number of additional queries for the same
element set data, just to get the name over and over again.