Fix sort.
Modify test to fix PhantomJS issue.