and some more fixes to the sql file