implement func install db, fix some issues