fixed bug in SQL statement for duplicate emails