         pane = atom.workspaceView.getActivePaneView().splitDown()
       else
         paneViews = atom.workspaceView.getPaneViews()
-        pane = paneViews[paneViews.length]
+        pane = paneViews[paneViews.length - 1]
 
       pane.activate()
       atom.workspace.open(uri, searchAllPanes: true)


      return unless protocol is 'spark-ide:'

      if pathname == '/cloud-variables-and-functions'
        @CloudVariablesAndFunctions ?= require './views/cloud-variables-and-functions-view'
        @cloudVariablesAndFunctionsView = new @CloudVariablesAndFunctions()

        return @cloudVariablesAndFunctionsView

  deactivate: ->
    @statusView?.destroy()


      className += _s.capitalize part

    @[className] ?= require './views/' + name
    key = className.charAt(0).toLowerCase() + className.slice(1)
    @[key] ?= new @[className]()
    @[key]

  # "Decorator" which runs callback only when user is logged in
  loginRequired: (callback) ->
