fixed inserting dupes into database