Fixed a bug in spmsort merge implementation when total_elems is not a multiple of n