Fixed bugs about database initialization.