Use stable_sort to avoid a segv in sort

Change-Id: I76b778728788c522e617d2c0ca0b3a62d132a897
Signed-off-by: Amit Bose <bose@noironetworks.com>