Fixed weak ordening in sort routine. Not easy.

Change-Id: Idae8ea69b8808196098001a5780b53e8be78e9d7
Updated

Change-Id: I710eeb7f6971f6781f148e596035d5f8a594805a