MIDI: improvements to SysEx template parsing