Use sqlite db, fix bug