Adding Minimize and Zoom menuItems

Hi, years ago I added in enableMenuItems of app the following code (courtesy of @Sam_Rowlands)

Sub EnableMenuItems() Handles EnableMenuItems
  #if targetMacOS
    declare function NSClassFromString lib "AppKit" ( className as CFStringRef ) as integer
    declare function NSApplicationSharedApplication lib "AppKit" selector "sharedApplication" ( classRef as integer ) as integer
    declare function NSApplicationKeyWindow lib "AppKit" selector "keyWindow" ( NSApplicationInstance as integer ) as integer
    
    if NSApplicationKeyWindow( NSApplicationSharedApplication( NSClassFromString( "NSApplication" ) ) ) <> 0 then FileClose.enable
  #endif
End Sub

It works all right; the only issue is that if, in MainMenuBar > WindowMenu I add the Minimize and Zoom menuitems, instead of showing at the top ot the items, they show below the above code (cfr Contrai and Ripristina items).

In order to have them show at the top, after removing them from the MainMenuBar I created two classes (menuItem) and in EnableMenuItems I dealt with them in this way:

if not menuLoaded then//load them once only
  dim m as new winMinimize
  m.Text = kMinimize
  m.Shortcut = "M"
  WindowMenu.AddMenuAt(0, m)
  dim mm as new winZoom
  mm.text = kZoom
  WindowMenu.AddMenuAt(1, mm)
  menuLoaded = true
end if

#if targetMacOS
  declare function NSClassFromString lib "AppKit" ( className as CFStringRef ) as integer
  declare function NSApplicationSharedApplication lib "AppKit" selector "sharedApplication" ( classRef as integer ) as integer
  declare function NSApplicationKeyWindow lib "AppKit" selector "keyWindow" ( NSApplicationInstance as integer ) as integer
  
  if NSApplicationKeyWindow( NSApplicationSharedApplication( NSClassFromString( "NSApplication" ) ) ) <> 0 then FileClose.enable
#endif

Now they show at the top of the WindowMenu and work all right, but, as you can see, the last but one menuitem (Remove Window from Set) is not followed by a separator. Even trying to add a separator it does not show.

I guess this is not the right way to deal with the issue.
Any idea how to set things straight?

BTW: I tested the more recent code posted on Xojo Blog by @Javier_Menendez but I get the same issue.
Thanks.