Patch for issue #184 - plugins setting hooks in multiple apps

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.