fixed bad handling of note end