Improved fix-for-duplicated-aces.xq.