Patch for issue #184 -- Please review

This patch solves the issue reported in #184, but I suspect there might be subtler details going on.
The change is to have hooks applied during the import of the plugin into an app.