diff --git a/include/ndn-cpp/data.hpp b/include/ndn-cpp/data.hpp
index cd6176f..8f97c87 100644
--- a/include/ndn-cpp/data.hpp
+++ b/include/ndn-cpp/data.hpp
@@ -236,10 +236,14 @@
   
 inline void
 Data::setContent(const Block& content) 
-{ 
+{
   onChanged();
 
-  content_ = content;
+  if (content.type() == Tlv::Content)
+    content_ = content;
+  else {
+    content_ = Block(Tlv::Content, content);
+  }
 }
 
 inline const Signature&
diff --git a/include/ndn-cpp/forwarding-entry.hpp b/include/ndn-cpp/forwarding-entry.hpp
index 1de79ce..315f271 100644
--- a/include/ndn-cpp/forwarding-entry.hpp
+++ b/include/ndn-cpp/forwarding-entry.hpp
@@ -40,33 +40,33 @@
   
   const std::string& 
   getAction() const { return action_; }
-  
-  Name& 
-  getPrefix() { return prefix_; }
-  
+
+  void 
+  setAction(const std::string& action) { action_ = action; wire_.reset(); }
+    
   const Name& 
   getPrefix() const { return prefix_; }
   
+  void
+  setPrefix(const Name &prefix) { prefix_ = prefix; wire_.reset(); }
+  
   int 
   getFaceId() const { return faceId_; }
 
+  void 
+  setFaceId(int faceId) { faceId_ = faceId; wire_.reset(); }
+      
   const ForwardingFlags& 
   getForwardingFlags() const { return forwardingFlags_; }
 
+  void 
+  setForwardingFlags(const ForwardingFlags& forwardingFlags) { forwardingFlags_ = forwardingFlags; wire_.reset(); }
+      
   int 
   getFreshnessPeriod() const { return freshnessPeriod_; }
 
   void 
-  setAction(const std::string& action) { action_ = action; }
-  
-  void 
-  setFaceId(int faceId) { faceId_ = faceId; }
-      
-  void 
-  setForwardingFlags(const ForwardingFlags& forwardingFlags) { forwardingFlags_ = forwardingFlags; }
-      
-  void 
-  setFreshnessPeriod(int freshnessPeriod) { freshnessPeriod_ = freshnessPeriod; }
+  setFreshnessPeriod(int freshnessPeriod) { freshnessPeriod_ = freshnessPeriod; wire_.reset(); }
 
   inline const Block&
   wireEncode() const;
@@ -190,6 +190,42 @@
     }
 }
 
+inline std::ostream&
+operator << (std::ostream &os, const ForwardingEntry &entry)
+{
+  os << "ForwardingEntry(";
+  
+  // Action
+  if (!entry.getAction().empty())
+    {
+      os << "Action:" << entry.getAction() << ", ";
+    }
+
+  // Name
+  if (!entry.getPrefix().empty())
+    {
+      os << "Prefix:" << entry.getPrefix() << ", ";
+    }
+
+  // FaceID
+  if (entry.getFaceId() >= 0)
+    {
+      os << "FaceID:" << entry.getFaceId() << ", ";
+    }
+
+  // ForwardingFlags
+  os << "ForwardingFlags:" << entry.getForwardingFlags() << ", ";
+
+  // FreshnessPeriod
+  if (entry.getFreshnessPeriod() >= 0)
+    {
+      os << "FreshnessPeriod:" << entry.getFreshnessPeriod() << ", ";
+    }
+
+  os << ")";
+  return os;
+}
+
 }
 
 #endif
diff --git a/src/data.cpp b/src/data.cpp
index 2bbe9a1..5a31e50 100644
--- a/src/data.cpp
+++ b/src/data.cpp
@@ -33,7 +33,7 @@
   wire_.push_back(getMetaInfo().wireEncode());
 
   // Content
-  wire_.push_back(content_);
+  wire_.push_back(getContent());
 
   if (!signature_) {
     throw Error("Requested wire format, but data packet has not been signed yet");
diff --git a/src/node.cpp b/src/node.cpp
index b766718..3610344 100644
--- a/src/node.cpp
+++ b/src/node.cpp
@@ -152,25 +152,33 @@
       return;
     }
 
-  switch(content.getAll().begin()->type())
+  Block::element_iterator val = content.getAll().begin();
+  
+  switch(val->type())
     {
     case Tlv::FaceManagement::ForwardingEntry:
       {
+        ForwardingEntry entry;
+        entry.wireDecode(*val);
+
+        // Save the onInterest callback and send the registration interest.
+        registeredPrefixTable_.push_back(ptr_lib::make_shared<RegisteredPrefix>(registeredPrefixId, prefix, onInterest));
+
+        /// @todo Notify user about successful registration
+        
         // succeeded
-        break;
+        return;
       }
     case Tlv::FaceManagement::StatusResponse:
       {
         // failed :(
         StatusResponse resp;
-        resp.wireDecode(*content.getAll().begin());
+        resp.wireDecode(*val);
 
         std::cerr << "StatusReponse: " << resp << std::endl;
       
         onRegisterFailed(prefix);
         return;
-      
-        break;
       }
     default:
       {
@@ -178,16 +186,8 @@
       
         onRegisterFailed(prefix);
         return;
-        break;
       }
     }
-
-     
-  
-  // Save the onInterest callback and send the registration interest.
-  registeredPrefixTable_.push_back(ptr_lib::make_shared<RegisteredPrefix>(registeredPrefixId, prefix, onInterest));
-
-  /// @todo Notify user about successful registration
 }
 
 void 
