It looks like this line should be changed to reference object instead of being remove.  Passing in a nil for object will cause an exception in find_node_by_name and object.to_s below, so we should continue to guard against nil here.