fix some bugs and add sqldb