moved check_un_duplicate to misc.php