Fixes bug with static API.
Adds check for duplicate plugins_loaded.