Making shared classed compatible with plugins_loaded hook