Better exception handling in PluginActivity. Removed redundent code