fixed the SQL