Fixed errors in the SQL script