Binary Search and Sort function bug fixed