Small fixes in the SQL output