DF Some fixes in sql.