merge preserves order to make sort stable