         process.chdir(dir)
         @sclang = new supercolliderjs.sclang(options)
 
+        unlisten = (sclang) ->
+          for event in ['exit', 'stdout', 'stderr', 'error', 'state']
+            sclang.removeAllListeners(event)
+
         @sclang.on 'state', (state) =>
           if state
             @bus.push("<div class='state #{state}'>#{state}</div>")
 
         @sclang.on 'exit', () =>
           @bus.push("<div class='state dead'>sclang exited</div>")
-          if atom.config.get 'atom-supercollider.growlOnError'
-            growl("sclang exited", {title: "SuperCollider"})
-          # how do you revive it ?
-          # @sclang = null
+          unless @recompiling
+            if atom.config.get 'atom-supercollider.growlOnError'
+              growl("sclang exited", {title: "SuperCollider"})
+          unlisten(@sclang)
+          @sclang = null
 
         sc3 = /^sc3>\s*$/mg
         @sclang.on 'stdout', (d) =>

    @emit = new Bacon.Bus()

  startSCLang: () ->
    opts =
      stdin: false
      echo: false

    deferred.promise

  recompile: ->
    @recompiling = true
    if @sclang?
      @sclang.quit()
        .then () =>
          @startSCLang()
    else
      @startSCLang()

  isCompiled: ->
    @sclang?.state is 'ready'
