Fixed bug when selecting an item from context menu would crash the application