diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -46,7 +46,7 @@ Pager.prototype.set = function (i, buf) {
 
   var page = this.pages[i]
 
-  if (page) page.buffer = buf
+  if (page) page.buffer = truncate(buf, this.pageSize)
   else page = this.pages[i] = new Page(i, buf)
 }
 
@@ -70,6 +70,14 @@ function grow (list, index, len) {
   return twice
 }
 
+function truncate (buf, len) {
+  if (buf.length === len) return len
+  if (buf.length > len) return buf.slice(0, len)
+  var cpy = alloc(len)
+  buf.copy(cpy)
+  return cpy
+}
+
 function alloc (size) {
   if (Buffer.alloc) return Buffer.alloc(size)
   var buf = new Buffer(size)
make sure page sizes are correct on set