   results
 
 isSameOrientationAsParent = (paneAxis) ->
-  paneAxis.getOrientation() is paneAxis.getParent().getOrientation()
+  paneAxis.getOrientation() is paneAxis.getParent().getOrientation?()
 
 buildPane = ->
   new Pane

  atom.workspace.getActivePane()

debug = (msg) ->
  return unless atom.config.get('paner.debug')
  console.log msg

splitPane = (pane, direction, params) ->
  method = "split#{_.capitalize(direction)}"

    return if atom.workspace.getPanes().length < 2
    currentPane = getActivePane()
    container = currentPane.getContainer()
    flexScale = currentPane.getFlexScale()
    root = container.getRoot()
    orientation = if direction in ['top', 'bottom'] then 'vertical' else 'horizontal'

    # If there is multiple pane in window, root is always instance of PaneAxis
    PaneAxis ?= root.constructor
    parent = currentPane.getParent()
    if root.getOrientation() isnt orientation
      container.setRoot(new PaneAxis({container, orientation, children: [root], flexScale}))
      root = container.getRoot()
      parent.removeChild(currentPane)
    else
      parent.removeChild(currentPane, true)

    switch direction
      when 'top', 'left' then root.addChild(currentPane, 0)
      when 'right', 'bottom' then root.addChild(currentPane)

    if atom.config.get('paner.mergeSameOrientaion')
      for axis in getAllPaneAxis(root) when isSameOrientationAsParent(axis)
        debug("merge to parent!!")
        mergeToParentPaneAxis(axis)
    # root.setFlexScale(1)
    currentPane.activate()
