Fix errors outlined in Issue #1

Fixes a few notices, warnings and a fatal with activated example plugin. Errors outlined in #1