       throw "obj already exists"
     list.splice pos, 0, obj
 
-  doNothing = ->
+  noop = ->
 
   escape = (str) ->
     # replace all " with \"
-    str.replace /"/g, '\\"'
+    str.toString().replace /"/g, '\\"'
 
   createEventHandlers: =>
     registrarNames = [

      # notify listeners
      @raiseEvent 'onLibraryUpdate'

  addTracksToLibrary: (msg, mpdTracksHandler=->) =>
    # build list of tracks from msg
    mpd_tracks = {}
    current_file = null

        handlers.splice i, 1
        return

  sendCommand: (command, callback=noop) =>
    @msgHandlerQueue.push callback
    @send command

  sendCommands: (command_list, callback=noop) =>
    return if command_list.length == 0
    @msgHandlerQueue.push callback
    @send "command_list_begin\n#{command_list.join("\n")}\ncommand_list_end"
