     unless @destroyed
       @file?.off()
       @destroyed = true
-      project?.removeBuffer(this)
+      @project?.removeBuffer(this)
 
   retain: ->
     @refcount++

  checkoutHead: ->
    path = @getPath()
    return unless path
    project.getRepo()?.checkoutHead(path)

  # Checks to see if a file exists.
  #

    @file = new File(path)
    @file.read() if @file.exists()
    @subscribeToFile()
    @state.set('relativePath', @project.relativize(path))
    @trigger "path-changed", this

  # Retrieves the current buffer's file extension.
