Fix bug from first commit on this branch which caused double execution of menu item commands.