                     opts.args.shift()
                 state_info = STATES[state]
                 if not state_info?
-                    err = "bug / internal error -- unknown state '#{misc.to_json(state)}'"
+                    err = "bug / internal error -- unknown state '#{misc.to_safe_str(state)}'"
                     dbg(err)
                     opts.after_command_cb?(err)
                     cb(err)

                        args.push("--time")
                    for k in ['path', 'start', 'limit']
                        args.push("--#{k}"); args.push(opts[k])
                    dbg("get listing of files using options #{misc.to_json(args)}")
                    @_action
                        action : 'directory_listing'
                        args   : args

                                            if STATES[mesg.state].stable
                                                p.emit('stable', mesg.state)
                                    else
                                        winston.debug("mesg (hub <- #{opts.host}): #{misc.to_safe_str(mesg)}")
                            cb()
        ], (err) =>
            opts.cb(err, @_socket_cache[opts.host])
