Mac menu fixes

These patches fix bugs with the menu bar on Mac.  See the commits for details.