Fix on sql statements