midi: fix issue #46