Fixed bug with duplicate inserts