         }
 
         if virtualInput != 0 {
-            MIDIEndpointDispose(virtOutput)
+            MIDIEndpointDispose(virtualOutput)
             virtualInput = 0
         }
     }

    public var midiOutPort = MIDIPortRef()

    // virtual midi source (output)
    public var virtOutput = MIDIPortRef()

    
    /// Array of MIDI Endpoints

            }
        }

        if virtualOutput != 0 {
            MIDIReceived(virtualOutput, packetListPtr);
        }
        
        packetListPtr.destroy()
