Added error checking to fix part of issue #1. The plugin should now be more stable.