fixed termination condition for mergeN