Fix the "chunk_max" calculation: exclude chunks that will not be part of the merge.