Fix cast in merge sort