Fix problem when using MERGE and indexes exist