Fixed a context menu bug introduced from previous refactoring commits