bunch of bug fixes in the plugin