Change midi file, fix potential bug in JNI C code