some fixes to dupe check, but not working yet!