diff --git a/lib/nodejs/lib/thrift/framed_transport.js b/lib/nodejs/lib/thrift/framed_transport.js
index f7daa3f..0d424d2 100644
--- a/lib/nodejs/lib/thrift/framed_transport.js
+++ b/lib/nodejs/lib/thrift/framed_transport.js
@@ -34,36 +34,31 @@
 TFramedTransport.prototype = new THeaderTransport();
 
 TFramedTransport.receiver = function(callback, seqid) {
-  var residual = null;
-
+  var residual = [];
+  
   return function(data) {
-    // Prepend any residual data from our previous read
-    if (residual) {
-      data = Buffer.concat([residual, data]);
-      residual = null;
+    // push received data to residual
+    for(var i = 0; i < data.length; ++i) {
+      residual.push(data[i])
     }
 
-    // framed transport
-    while (data.length) {
-      if (data.length < 4) {
-        // Not enough bytes to continue, save and resume on next packet
-        residual = data;
+    while (residual.length > 0) {      
+      if (residual.length < 4) {
+		// Not enough bytes to continue, save and resume on next packet
         return;
       }
-      var frameSize = binary.readI32(data, 0);
-      if (data.length < 4 + frameSize) {
-        // Not enough bytes to continue, save and resume on next packet
-        residual = data;
+      // get single package sieze
+      var frameSize = binary.readI32(Buffer.from(residual.slice(0, 4)), 0);
+      // Not enough bytes to continue, save and resume on next packet
+      if (residual.length < 4 + frameSize) {
         return;
       }
 
-      var frame = data.slice(4, 4 + frameSize);
-      residual = data.slice(4 + frameSize);
-
+      // splice first 4 bytes
+      residual.splice(0, 4)
+      // get package data
+      var frame = Buffer.from(residual.splice(0, frameSize));      
       callback(new TFramedTransport(frame), seqid);
-
-      data = residual;
-      residual = null;
     }
   };
 };
