fix bugs in midi plugin
improving midi plugin