fixing sort logic
Merge pull request #25 from mac-/master

fixing sort logic