Fixed two bugs in midifiles.py.