fixed the SQL tables