Fix the bug of getting database.