move to plugins_loaded hook