fixing errors in app_init to connect to database