Fix temporary duplicate key issue