new multiway merge function does not work correctly.