resolved fdo#77018 keep external references intact during sort

Needs e463de2a56453a0d2cb0b5b58e96f7639f37cdd1 fix for fdo#79441 to
work.

Change-Id: Ide1cbeb4b25b17b5102977ccbdf8e6dbfcadfc60