Fixed long issue in msd sort