Fix label sorting issues with appendices
Improved test