             text = m[1]
 
       if not @isVisible or @currentRegex != text
-        @.find('div.error-message').remove()
+        @spView.find('div.error-message').remove()
         try
           @showRailRoadDiagram(text, flavour)
         catch error

  toggle: ->
    #console.log "RegexRailroadDiagramView was toggled!"

    statusBar = @view.find('.status-bar')

    if statusBar.length > 0
      @insertBefore(statusBar)

    false

  showRailRoadDiagram: (regex, flavour) ->
    rr = @spView.find '.regex-railroad-diagram'

    if not rr.length
      # create current diff
      @hide()

      # append to "panes"
      v = atom.views.getView(atom.workspace.getActivePane())
      $(v).parents('.panes').eq(0).after(@)

    @children().remove()
    Regex2RailRoadDiagram(regex, @.get(0), flavour: flavour)
