Fixed replace dupes with primary keys on db tables