Fixed the last of the SQL