midiogre: fix a lot of crashes