fix sorting stacked units.