Fixed some small bugs in the SQL file