small fix to sql