fixed bug: issues with javascript and sort functions not working