fix to sql