Fixing issues with multiple database calls in init function