Fix a problem of noteOn
Clean codes