fixed bug in javascript sort files