Correct a SQL bug in dbmng_duplicate