Fixed Bug in Sorting
fix js bugs