libmid: fix sysex handling