add raw insertion sort and fix terminating condition for merge sort