sort the tags before setting

this isn't necessary for actual functionality but is easier for unit
tests