Fixes 3047 on Master Bracnh - SortingUtil integer overflow during comparision

Fixes #3047