fixed sorting, fixed #197