added extension_loaded check