General fix&cleanup for events and midi-out