fixes to sql creator