Fixed some database access issues in the init functionality.