Fix some problem of using local database.