fix sort stability