Fixed the incorrect sorting result in IE/Chrome

My bad. My previous implementation is not compatible with IE/Chrome.

Fix: the original sort function does not follow ECMA standards and will generate an incorrect result in IE/Chrome.
Fix: the sorting result is unstable.