Fixed various issues in plugin.