basesql bugfix