fix wrong sort result bug

also fix wrong unicode file creation