Fixed optimization bug in ordering of volumes after merge