Add initialization steps and repair the database access function