fixed sql stuffs