It could be as simple as changing the Sort By from Name to Key.
Or be explicit about it by adding another field in your DSV called
ContractIDSort, and do a T-SQL Cast on it.
Then add another attribute to the dimension. Then make the
ContractID, original attribute, as a Sort By the attribute
ContractIDSort.
That should eliminate the issue.
-exologic