Move plugin instantiation to after all plugins are registered
Fix plugin api tests