Buf update length fix