Sort correctly to remove duplicates

Ticket:	#2457
Merge:	releng/9.1.0
(cherry picked from commit 59621d9afe3dedcfdf1911cdb79dc6f748db7608)