fix crashes after disposing a plugin instance