Fix Error In Sort Function