Fix bad query from remote users without email

If a remote user is found by name and does not have an email address, a bad
SQL query would be generated