minor changes to sql