Slight bug fixes and plugin event handling