fix bug where too many event handlers for context menus were removed