fixed several error handling bugs in plug-in setup.