fixed sorting link IDs