[FIX] more stringent check for putative duplicates; removes dups earlier
[FIX] warning about signed/unsigned comparison in debug
cosmetics
[FIX] fix build with clang on Linux